繁体   English   中英

PHP htmlentities()和htmlspecialchars()损坏/不起作用

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM