Why do inner text is not active的innerText在simple_html_dom
[這裏是HTML代碼]
<ul class="product">
<li class="product col-md-4 col-sm-4 col-xs-6 "><div class="product-header">
<a href="/so-mi-octopus-xanh-soc-trang-p5163098.html">
<img src="//cdn.nhanh.vn/cdn/store/17863/ps/20170925/0ctopus_thumb_450x600.jpg" class="attachment-shop_catalog size-shop_catalog wp-post-image">
</a><div class="buttons">
<a href="/so-mi-octopus-xanh-soc-trang-p5163098.html" rel="nofollow" class="button add_to_cart_button">
<i class="fa fa-shopping-bag" aria-hidden="true"></i>
<span class="screen-reader-text">Thêm vào giỏ</span></a>
<a data-product_id="5163098" class="button btnFav" rel="nofollow">
<i class="fa fa-heart-o" aria-hidden="true"></i>
<span class="screen-reader-text">Yêu thích</span>
</a></div></div><h3><a href="/so-mi-octopus-xanh-soc-trang-p5163098.html">Sơ mi Octopus xanh sọc trắng</a></h3><span class="price">
<span class="woocommerce-Price-amount amount">
400,000 ₫ </span>
</span></li>
</ul>
[這裏是我的代碼]
<?php
require "simple_html_dom.php";
$html=file_get_html("http://zuhaus.vn/zu-design-pc150502.html?page=1");
$ds=$html->find("ul.products li");
foreach ($ds as $sp) {
# code...
$price=$sp->find("span.price span",0);
echo $price;
$name=$sp->find("h3 a",1)->innertext;
echo $name;
}
?>
我已經嘗試了很多的測試用例但它不會工作:「< T漢克斯你 P/S我用庫simple_html_dom
請將代碼放在問題中,而不是在外部網站上。在您自助**後,StackOverflow上的用戶將幫助您。參觀:http://stackoverflow.com/tour。做一些研究:https://meta.stackoverflow.com/q/261592/1011527。 瞭解如何發佈好問題:http://stackoverflow.com/help/how-to-ask。和http://stackoverflow.com/help/mcve。 – Nic3500