strpos 中是否有包含 html 的字符串有问题


Does strpos have an issue with a string that has html in it?

strpos找不到>$2.99<。我在 if 语句之前回显了$html,我可以在其中找到>$2.99<,但结果是 not found .

$webpage = file_get_contents ($itunesurl);
$html = htmlspecialchars ($webpage); 
echo $html;

if(strpos($html, '>$2.99<') !== FALSE) {
    echo 'found';
}
else {
    echo 'not found';
    }

搜索$webpage而不是$html,因为><字符被htmlspecialchars转换为实体。

if(strpos($webpage, '>$2.99<') !== FALSE) {
    echo 'found';
}
else {
    echo 'not found';
}