在PHP中可以使用strip_tags函数去除HTML标签,看下面示例: <?php $str = 'www<p>dreamdu</p>.com'; echo(htmlspecialchars($str)."<br>"); echo(strip_tags($str)); ?>