当前位置:首页 > PHP教程 > PHP基础知识

如何去掉文章里的 html 语法

<?
$a="<font color=red>这是一个带html标识的字串</font>";
$a=strip_tags($a);
print $a;
?>


2
<?
$a="<font color=red>这是一个带html标识的字串</font>";
ereg_replace("^<.+>$", "", $a);
print $a;
?>


3 保留原有内容

<?
$a="<font color=red>这是一个带html标识的字串</font>";
ereg_replace("<", "<", $a);
ereg_replace(">", ">", $a);
print $a;
?>

【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!