如何过滤单引号等特殊字符? 可以用str_replace()来进行替换或者用addslashes()来为引号加上斜杠或者把PHP。INI中的MAGIC_QUOTES_GPC设为on 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 忘记说一点可以用intval()来过滤,如果你的id是数字的话 欢迎加入PHP WAP QQ群8352641 大家一起交流,一起进步.共同发展 <? function strReplace($string){ $text=$string; $text=str_replace(">",">",$text); return $text; } $content=strReplace("<a href='newshow.php?id=$arr[id]' target='_blank'>$arr[title]</a>"); echo "$content" ; ?> 这么写以后报错:Fatal error: Cannot redeclare strreplace() (previously declared in D:\Program Files\Apache2\htdocs\news\shownews.php:97) in D:\Program Files\Apache2\htdocs\news\shownews.php on line 9797行是function strReplace($string){哪里出错了呢? strreplace() =>str_replace() 你报的错是重复定义。别的地方已经有strreplace了 str_replace()替换成双引号就可以了 http://blog.csdn.net/heiyeshuwu/archive/2005/06/14/394225.aspx 多个自定义函数该怎么传? phpmailer 发邮件问题 , 服务器连接不上 这个网站报价要多少钱?? 问个基础问题 求 php 图片压缩代码 从 WBMP 文件或 URL 新建一图像 没有按我的思路走,什么地方错了。。。。 如何开发供PHP调用的so模块? 80分 求解图片上传问题。 怎样让textarea默认显示的值即一个变量的内容? 怎样点击按钮后获取当前页面的40个单选框值,形成一个字符串 如何安装gd图形库,谢谢 IE地址栏前换成自己的图标的语句死活无效,一气只下把电脑卖了呵呵
function strReplace($string){
$text=$string;
$text=str_replace(">",">",$text);
return $text;
}
$content=strReplace("<a href='newshow.php?id=$arr[id]' target='_blank'>$arr[title]</a>");
echo "$content" ;
?> 这么写以后报错:Fatal error: Cannot redeclare strreplace() (previously declared in D:\Program Files\Apache2\htdocs\news\shownews.php:97) in D:\Program Files\Apache2\htdocs\news\shownews.php on line 97
97行是function strReplace($string){哪里出错了呢?
=>
str_replace()
替换成双引号就可以了