2013-04-11 67 views

回答

3

采用htmlentities将工作:

<?php echo 'Allowable tags: ' . htmlentities('<a><b>'); ?> 
0

转换的特殊字符用PHP htmlentities()为HTML实体,像这样:

<?php echo htmlentities('Allowable tags: <a><b>'); ?> 
0

htmlspecialchars - 转换特殊字符为HTML实体。

<?php echo htmlspecialchars('Allowable tags: <a><b>'); ?> 

输出HTML:

Allowable tags: &lt;a&gt;&lt;b&gt; 

视为:

容许标签:<一个> <b>

相关问题