我试图从 html 源代码中获取价格,这里是源代码的一部分
<h1>
<span id="ctl00_PageHeaderContentPlaceHolder_lblRegion">Product Name</span>
<strong id="ctl00_PageHeaderContentPlaceHolder_divFiyat" class="price">
749 €
<small>
2007 TL
<small class="nightday">
<span id="ctl00_PageHeaderContentPlaceHolder_lblNightDay">Un related detals</span></small></small>
</strong>
</h1>
正如您在此处看到的,它是非常指定的 id。这是我的代码..
$Tour_Price ="/<span id=\"ctl00_PageHeaderContentPlaceHolder_divFiyat\" class=\"price\">(.*?)<\/span>/i";
preg_match($Tour_Price , $Tur_Fiyat, $Result_Price);
echo "<strong>Result:</strong>".$Result_Price[1];
我的代码在源代码的其他部分完美运行。但价格只是没有。请拍摄想法。感谢所有感兴趣的人:)