0

strpos没有找到>$2.99<。我$html在 if 语句之前已经回显了,我可以在其中找到>$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';
    }
4

1 回答 1

1

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

if(strpos($webpage, '>$2.99<') !== FALSE) {
    echo 'found';
}
else {
    echo 'not found';
}
于 2013-11-07T14:22:16.417 回答