close
PHP 5.4 支持 單引號 轉換 htmlspecialchars htmlentities
var_dump(get_html_translation_table(HTML_ENTITIES, ENT_QUOTES | ENT_XML1));
The result will look like this:
array(5) {
["""]=>
string(6) """
["&"]=>
string(5) "&"
["'"]=>
string(6) "'"
["<"]=>
string(4) "<"
[">"]=>
string(4) ">"
}
echo htmlspecialchars("&<>\"'", ENT_QUOTES | ENT_XML1);
echo html_entity_decode("&<>"'", ENT_QUOTES | ENT_XML1);
http://nikic.github.io/2012/01/28/htmlspecialchars-improvements-in-PHP-5-4.html
文章標籤
全站熱搜
留言列表