簡體   English   中英

如何使用簡單的html dom刪除html中的元素?

[英]how to delete the elements in html using simple html dom?

我正在嘗試這個,但是沒有用

 include_once('simple_html_dom.php');
             $handle = file_get_html('file name.php');
             if (!empty($handle)) {
             $ret = $handle->find('div', 0);//this is able to find the element
             echo $ret;
             $ret->outertext = '';//this is **NOT** deleting the video

outertext=''; 不工作,我不知道為什么

我試過$handle->find('div[id="'.$i.'"]', 0)->outertext = ''; 但這也不起作用。

我沒有嘗試過的其他方法嗎?

我不明白為什么這會有所作為,但請嘗試使用查找結果進行內聯修改。

$handle->find('div', 0)->outertext = '';

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM