一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

php过滤非法字符函数

时间:2010-09-13 编辑:简简单单 来源:一聚教程网

$str ="fdafsa''&#x";
echo htmlspecialchars( $str );
/*
& (和) 转成 &
" (双引号) 转成 "
< (小于) 转成 <
> (大于) 转成 >
此函式只转换上面的特殊字元,并不会全部转换成 html 所定的 ascii 转换

*/

//输出

html_entity_decode($str);

/*
于html_entity_decode在大多数情况下是与htmlspecialchars htmlentities配合使用的

*/

热门栏目