我有两个preg_matchs,一个是函数,另一个不是

时间:2015-01-17 20:18:41

标签: php preg-match file-get-contents

此代码正常运行

$content = file_get_contents('http://www.professor-oak.com/cardorders/ItemDetails.asp?IID=' . $row['POID']);
preg_match('#<span itemprop="price">(.*)</span>#', $content, $match);
$price = $match[1];

但这不是

$content = file_get_contents('http://www.trollandtoad.com/p1062197.html');
preg_match('#</div><div class="priceSection">$(.*)</div></div>#', $content, $match);
$price2 = $match[0];
echo $price;

对于我的生活,我无法弄清楚为什么。

我测试了链接并测试了正在检索的信息;两者都在发挥作用。

但是我无法将它传到preg_match。 我没有在同一页面上运行它们。

0 个答案:

没有答案