<div class="product-info" style="min-height: 190px;">
<h2 class="product-name"><a title="Ottoman" href="">Ottoman</a></h2>
<div class="price-box">
<span id="product-price-51" class="regular-price">
<span class="price">$299.99</span></span>
</div>
<div class="ratings">
<div class="rating-box">
<div style="width:69%" class="rating"></div>
</div>
<span class="amount"><a onclick="var t = opener ? opener.window : window; t.location.href=''; return false;" href="#">4 Review(s)</a></span>
</div>
<div class="actions">
<button onclick="setLocation('')" class="button btn-cart" title="Add to Cart" type="button"><span><span>Add to Cart</span></span></button>
<ul class="add-to-links">
<li><a class="link-wishlist" href="">Add to Wishlist</a></li>
<li><span class="separator">|</span><a class="link-compare" href="/">Add to Compare</a></li>
</ul>
</div>
</div>
我想要
<button onclick="setLocation('')" class="button btn-cart" title="Add to Cart" type="button"><span><span>Add to Cart</span></span></button>
从上面的html使用zend_dom_query
答案 0 :(得分:0)
use Zend\Dom\Query;
$dom = new Query($html);
$result = $dom->execute('.btn-cart');