[英]PHP htmlentities() and htmlspecialchars() are broken / do not work
我过去曾经使用过这两个功能,但它们运行良好。 我正在开发CakePHP应用程序,由于某种原因,使用这两个功能都没有。 我已经设置了一个简单的测试,但我不敢相信它返回了true:
$loc_title = htmlentities($location['locations']['title']);
if(htmlentities($location['locations']['title']) === $location['locations']['title']){
echo "htmlentaties is broken.";
}
是什么导致这些功能无法正常工作?
考虑改变
htmlentities($location['locations']['title'] === $location['locations']['title'])
至
htmlentities($location['locations']['title']) === $location['locations']['title']
例如 ;-)
Beause您在这里所做的是将标题与其自身进行比较的结果是逃避了实体。 最有可能评估为真。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.