[英]Is it possible to modify innertext of an element with simpleHTMLdom and save the modified content to local file?
[英]SimpleHtmlDom Edit and Save file
http://simplehtmldom.sourceforge.net/
試圖解析HTML文件,進行一些小的更改,然后使用更新覆蓋當前文件。 想知道是否可以通過simplehtmldom實現
到目前為止,我可以訪問所有內容,但是無法顯示包含所有更改的全部HTML內容。 只能獲取特定的值嗎?
如果是這樣,我還可以使用什么其他方法來完成此任務? 恐怕由於安全問題,我必須工作的環境非常有限。
simplehtmldom對象可以用作字符串,並且僅包含修改后的文檔的全部內容。
例如:
echo($html);
file_put_contents($filename, $html);
如果您喜歡面向對象的方法,可以使用save()
:
$updated = $html->save();
要么
$html->save($filename);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.