怎么实现不了? $C_char=ereg_replace("<[^>]*>","",$C_char);改为$C_char=ereg_replace("<[^>]+*>","",$C_char);试试看 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 $title="<b>this is test</b>";echo "$title <br>";$title_1 = charreplace($title);echo "$title_1"; <?function charreplace($C_char){$C_char=addslashes($C_char);$C_char=ereg_replace("<[^>]*>","",$C_char);return $C_char;}$title="<font color=red>this is test</font>";echo "$title <br>";$title=charreplace($title);echo "$title";?>第二次输出$title时,$title还是原来的值啊,没有重新赋值。 改了的就变成这样了:Warning: REG_BADRPT in /usr/local/apache/htdocs/test.php on line 11 请问 uGain(幽亘) 那应该怎样做才能实现呢? wangxiangjun_sun() 说的是对的了。谢谢哦。 把charreplace($title);改成$title = charreplace($title); 不好意思,刚刚搞错了$title="<b>this is test</b>";echo "$title <br>";charreplace($title);echo "$title";第二个echo并没有输出新值$title="<b>this is test</b>";echo "$title <br>";$title=charreplace($title);echo "$title"; 没有问题请看<?$a="<b>aaa</b>";$b=ereg_replace("<[^>]*>","",$a);echo $b;//aaa?> 完整程序代码应该是function charreplace($C_char){$C_char=addslashes($C_char);$C_char=ereg_replace("<[^>]*>","",$C_char);return $C_char;}$title="<b>this is test</b>";echo "$title <br>";$title=charreplace($title);echo "$title";有两个问题:1. 没有保存新的结果2. return 语句后遗漏一个$ 根本不仔细看回复的。sigh 请教:PHP 一个页面怎样必须从指定的页面链接进入,不能直接输入地址进入? php中如何实现静态变量? 前缀不同可以恢复数据么 web2.0标准是什么?我怎么就不明白什么意思呢? 想把Discuz论坛的最热门的帖,放到网站上,是哪个表哪个字段呢? Smarty模版不能编译了,是怎么回事? 请问一下关于mb_convert_encoding和记事本默认字符集 文字居中 PHP配置的一个错误问题?急,,,在线等。。。 如何在不同页面间共享数组内容? 请教如何验证提交的表单!大家帮个忙吧! 有51.net空间的朋友来看看,Session为什么不能用
echo "$title <br>";
$title_1 = charreplace($title);
echo "$title_1";
function charreplace($C_char)
{
$C_char=addslashes($C_char);
$C_char=ereg_replace("<[^>]*>","",$C_char);
return $C_char;
}$title="<font color=red>this is test</font>";
echo "$title <br>";
$title=charreplace($title);
echo "$title";
?>
第二次输出$title时,$title还是原来的值啊,没有重新赋值。
$title="<b>this is test</b>";
echo "$title <br>";
charreplace($title);
echo "$title";
第二个echo并没有输出新值
$title="<b>this is test</b>";
echo "$title <br>";
$title=charreplace($title);
echo "$title";
<?
$a="<b>aaa</b>";
$b=ereg_replace("<[^>]*>","",$a);
echo $b;//aaa
?>
function charreplace($C_char)
{
$C_char=addslashes($C_char);
$C_char=ereg_replace("<[^>]*>","",$C_char);
return $C_char;
}$title="<b>this is test</b>";
echo "$title <br>";
$title=charreplace($title);
echo "$title";有两个问题:
1. 没有保存新的结果
2. return 语句后遗漏一个$
sigh