htmlentities / htmlspecialchars 等 html 编解码

最后更新于:2022-04-02 02:29:12

[TOC] ## 实例 ``` $orig = "I'll \"walk\" the dog now"; $a = htmlentities($orig); echo $a.PHP_EOL; // I'll "walk" the <b>dog</b> now $b = htmlspecialchars($orig); echo $b.PHP_EOL; // I'll "walk" the <b>dog</b> now $a1 = html_entity_decode($a); echo $a1.PHP_EOL; // I'll "walk" the dog now $b1 = htmlspecialchars_decode($b1); echo $b1.PHP_EOL; // I'll "walk" the dog now ```
';