嗨,我使用simple_html_dom
php庫從其他網站獲取內容。Html Dom解析器獲取第一個元素
我有以下HTML結構,
<h1 class="nik_product_title" style="color: #000;">
DSLR D7100
<span class="new_big_parent">
<span class="new_big_child">
<span class="new_big_child1">new</span>
</span>
</span>
</h1>
使用這種
@$html->find ('div[class=nik_block_product_main_info_component_inner] h1',0)->plaintext;
,但我發現輸出DSLR+D7100new
如何獲得第一隻純文本即需要獲取只有DSLR D7100
太簡單了!沒有意識到這一點。謝謝pguardiario。 – Vind
感謝@pguardiario這個非常簡單的答案 – Gunaseelan
@pguardiario您對[this]有任何想法嗎?(http://stackoverflow.com/questions/22669373/php-simple-html-dom-parser-cant-get-content-上分頁) – Vind