html代码 php下过滤HTML代码的函数
程序员文章站
2024-02-06 08:42:04
...
/*----------------------
过滤HTML代码的函数
-----------------------*/
function htmlEncode($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("<"," $string=str_replace(" $string=str_replace(">",">",$string);
$string=str_replace(">",">",$string);
$string=str_replace(" "," ",$string);
$string=nl2br($string);
return $string;
}
过滤HTML代码的函数
-----------------------*/
function htmlEncode($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("<"," $string=str_replace(" $string=str_replace(">",">",$string);
$string=str_replace(">",">",$string);
$string=str_replace(" "," ",$string);
$string=nl2br($string);
return $string;
}
以上就介绍了html代码 php下过滤HTML代码的函数,包括了html代码方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
上一篇: php读xml
下一篇: 程序员开发大型应用程序的技巧