php:htmlspecialchars() 函数把一些预定义的字符转换为 HTML 实体。
一个是:mysql_real_escape_string
一个是:addslashes
mysql_real_escape_string与addslashes的区别在于
mysql_real_escape_string总是将“’”转换成“\’”
而addslashes
在magic_quotes_sybase=on时将“’”转换成“””
在magic_quotes_sybase=off时将“’”转换成“\’”
htmlspecialchars()函数把一些预定义的字符转换为 HTML 实体。
js:encodeURIComponent() 函数可把字符串作为 URI 组件进行编码。