如何在PHP中搜索字符串中的关键字?

时间:2013-11-07 13:17:31

标签: php

如何搜索$ html这些确切的单词“$ 2.99 Buy”,并在找到时返回正数?如果它区分大小写也会有所帮助。

我的目标是检查iTunes并查看当前所选书籍是否仍为2.99美元

<?php $html = file_get_contents ($urlonitunes);

echo $html;?>

1 个答案:

答案 0 :(得分:3)

使用strpos()

if(strpos($html, '$2.99 Buy') !== FALSE) {
    echo 'found';
}
相关问题