有沒有像Js操控HTML中DOM模型的PHP類,推薦一個解決方案

來源:互聯網
上載者:User
有沒有像Js操控HTML中DOM模型的PHP類,推薦一個
目前找到一個 HTML SQL的類,功能也不錯,可惜感覺作者是在把功能花哨化、複雜化。

想實現這樣的一個功能。

$body = file_get_content(http://www.4wei.cn);

$title = dom('title');

$div = dom()->tag('div')->id('my_div_id');
$class = $div->class;

$input = dom()->form('my_form')->tag('input')->name('name');
$input->value;

如此功能。

------解決方案--------------------
幫你頂
------解決方案--------------------
系統內建的DOMDocument類
------解決方案--------------------
查的咋樣啦
------解決方案--------------------
探討
找到一個HTML DOM類,差不多就是我想要的效果了。

PHP Simple HTML DOM Parser

http://simplehtmldom.sourceforge.net/manual.htm

------解決方案--------------------
phpQuery
------解決方案--------------------
感謝分享~
------解決方案--------------------
mark
------解決方案--------------------
PHP Simple HTML DOM Parser 不錯,
不過要注意它容易產生記憶體問題, 對象用完後要顯式調用它的__destruct函數
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.