0
<html>
<div class="product-tile ">
<div class="product-image">
<img src="1.jpg">
<img src="2.jpg">
</div>
<div class="brand">
<a href="example1.html" class="brand-link">
Example1
</a>
</div>
<div class="product-name">
<a href="/product/example1.html" class="name-link">Craquelé-Effect Leather Square-Toe Mules</a>
</div>
</div>
<div class="product-tile ">
<div class="product-image">
<img src="11.jpg">
<img src="12.jpg">
</div>
<div class="brand">
<a href="example2.html" class="brand-link">
Example2
</a>
</div>
<div class="product-name">
<a href="/product/example1.html" class="name-link">Craquelé-Effect </a>
</div>
</div>
</html>
我的內容是這樣的在HTML
,並希望將其複製到我的網站。 我的代碼就像如何獲得標題,圖片,品牌和價格。我已經在其中使用了file_get_html
,但是我在獲取datalike品牌和價格時遇到了問題。從其他網站複製到您的基於div
require('simple_html_dom.php');
$html = file_get_html('new_arrival.html');
//$product = [];
foreach ($html->find('div.wrap-desc') as $pro) {
$proDetails = $pro->find('div.brand');
}
「如果你使用jQuery「 - 他們不是。他們正在使用PHP的Simple HTML Dom。問題上的標籤和其中的代碼清楚地表明瞭這一點。 – Quentin
謝謝麥克斯我不只使用PHP和主要的div是產品瓦和其他品牌的價格,圖像裏面也請提到這個foreach –