Skip to content

web编码tips

solei1 edited this page May 6, 2017 · 1 revision
  1. html有html实体

  2. js的转义有如下函数

  • encodeURI && decodeURI
  • encodeURIComponent && decodeURIComponent
  • escape && unecape

3。 php转义的配置和函数

1.magic_quotes_runtime 2. magic_quotes_gpc 3. addslashes() 和 stripslashes() 4. mysql_escape_string() 5. addcslashes() 和 stripcslashes() 6. htmlentities() 和 html_entity_decode() 7. htmlspecialchars() 和 htmlspecialchars_decode() 8. strip_tags

  1. html实体出现在标签的事件属性中是可以被解释的。也就是说 是可以弹窗的。&#039是单引号。

  2. 浏览器会自动对get和post的参数进行urlencode,php对浏览器传过来的参数自动进行urldecode。

Clone this wiki locally