0

過去にこれら 2 つの関数を使用したことがありますが、問題なく動作しました。私は 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']

例えば ​​;-)

ここで行っているのは、タイトルとそれ自体を比較した結果、エンティティをエスケープすることです。これはおそらくtrueと評価されます。

于 2011-12-14T20:59:29.920 に答える