$content=str_replace(chr(34),""",$content)
可以修改为:
$content=str_replace(chr(34),'"'",$content)
或者取消,好像没有什么本质意义。
程序前面几行替换HTML代码的,代码中间不能有空格,你写错了。
我修改后,完整的测试程序如下,测试通过,没有问题,能够替换:
<?php
function unhtml($content)
{
$content=str_replace("&","&",$content)
$content=str_replace("<","<",$content)
$content=str_replace(">",">",$content)
$content=str_replace(" "," ",$content)
$content=str_replace(chr(13),"<br>",$content)
$content=str_replace("\\","\\\\",$content)
$content=str_replace("台什么","不文明用语",$content)
$content=str_replace("[emt]","<img src=images/xyq/",$content)
$content=str_replace("[/emt]",".gif/>",$content)
return $content
}
$str='台什么[emt]1[/emt]'
echo unhtml($str)
?>
程序运行过程如下:
E:\ygb>php a.php
不文明用语<img src=images/xyq/1.gif/>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)