0

我过去使用过这两个功能,它们运行良好。我正在开发一个 CakePHP 应用程序,出于某种原因,使用这些函数中的任何一个都不起作用。我已经设置了一个简单的测试,我不敢相信它会返回 true:

$loc_title = htmlentities($location['locations']['title']);

if(htmlentities($location['locations']['title']) === $location['locations']['title']){

    echo "htmlentaties is broken.";
}

什么可能导致这些功能停止正常工作?

4

1 回答 1

4

考虑改变

htmlentities($location['locations']['title'] === $location['locations']['title'])

htmlentities($location['locations']['title']) === $location['locations']['title']

例如 ;-)

因为您在这里所做的是在将标题与其自身进行比较的结果中转义实体。最有可能评估为真。

于 2011-12-14T20:59:29.920 回答