close
[php]html_entity_decode — 函數把 HTML 實體轉換為字符。
範例
<?php
$str = "John & 'Adams'";
echo html_entity_decode($str);
echo "<br />";
echo html_entity_decode($str, ENT_QUOTES);
echo "<br />";
echo html_entity_decode($str, ENT_NOQUOTES);
?>
瀏覽器輸出:
John & 'Adams'
John & 'Adams'
John & 'Adams'
如果在瀏覽器中查看源代碼,會看到這些 HTML:
<html>
<body>
John & 'Adams'<br />
John & 'Adams'<br />
John & 'Adams'
</body>
</html>
全站熱搜