当然,之前已经提出了这个问题并且已经找到了解决方案,所有这些解决方案迄今为止都没有用我想通过使用htmlentities或htmlspecialchars将TM符号和&符改为他们的html equivelents:
$TEST = "Kold Locker™ & other stuff"; echo "ORGINIAL: " . $TEST . "<BR/>"; echo "HTML: " . htmlentities($TEST,ENT_COMPAT,'UTF-8');
ORGINIAL: Kold Locker™ & other stuff HTML:
我也用htmlspecialchars尝试了它,第二个参数改变了相同的结果.@H_301_4@
我错过了其他人声称在其他解决方案中工作的内容?@H_301_4@
更新:我尝试显示utf8_encode($TEST)并显示HTML:Kold Locker™&其他的东西@H_301_4@
你的代码适合我: – ?
原文链接:https://www.f2er.com/php/130589.html在manual page for htmlentities()
我们可以读到:@H_301_4@
Return Values@H_301_4@
Returns the encoded string.@H_301_4@
If the input string contains an invalid code unit sequence within the
given encoding an empty string will be returned,unless either the
ENT_IGNORE or ENT_SUBSTITUTE flags are set.@H_301_4@
我的猜测是输入数据没有正确编码为UTF-8,函数返回一个空字符串. (假设脚本没有崩溃,即该部分仍然运行后的代码.)@H_301_4@