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 –