我有这段代码:
$string = "Perfect Valentine's Day Care Package | SpouseBuzz.com";
echo $string ."\n";
echo html_entity_decode($string) ."\n";
它返回:
Perfect Valentine's Day Care Package | SpouseBuzz.com
Perfect Valentine's Day Care Package | SpouseBuzz.com
我的问题是:为什么html_entity_decode没有转换html实体?
谢谢!
答案 0 :(得分:3)
html_entity_decode()
只会转换双引号并且会单独留下单引号。要将单引号转换为相应的字符,请添加ENT_QUOTES
标志:
echo html_entity_decode($string, ENT_QUOTES, 'UTF-8');