手机
当前位置:查字典教程网 >编程开发 >php教程 >php下过滤HTML代码的函数
php下过滤HTML代码的函数
摘要:/*----------------------过滤HTML代码的函数-----------------------*/functionht...

/*----------------------

过滤HTML代码的函数

-----------------------*/

functionhtmlEncode($string){

$string=trim($string);

$string=str_replace("&","&",$string);

$string=str_replace("'","",$string);

$string=str_replace("&","&",$string);

$string=str_replace(""",""",$string);

$string=str_replace(""",""",$string);

$string=str_replace("&lt;","<",$string);

$string=str_replace("<","<",$string);

$string=str_replace("&gt;",">",$string);

$string=str_replace(">",">",$string);

$string=str_replace("&nbsp;","",$string);

$string=nl2br($string);

return$string;

}

【php下过滤HTML代码的函数】相关文章:

php代码优化及php相关问题总结

php快速查找数据库中恶意代码的方法

php 类自动载入的方法

php将HTML表格每行每列转为数组实现采集表格数据的方法

php页面缓存ob系列函数介绍

php动态函数调用方法

php的计数器程序

php中关于socket的系列函数总结

php中文件上传的安全问题

php分页函数

精品推荐
分类导航