我必须转换这些符号:
- >
- ✌ ;
- 。
等。
自:
- >
- ✌
我该怎么做?PHP中有任何人可以做到这一点吗?
你可以
使用 PHP 的 html_entity_decode()
函数:
<?php
$str = ">";
$str = html_entity_decode($str);
$str1 = "✌";
$str1 = html_entity_decode($str1);
?>
更多信息请见 http://php.net/manual/en/function.htmlentities.php。
注意:html_entity_decode()
函数与htmlentities()
函数相反。
希望这有帮助,谢谢!
<?php
$str = "This is some <b>bold</b> text.";
echo htmlspecialchars_decode($str);
?>
htmlspecialchars_decode