简体   繁体   中英

SimpleHtmlDom Edit and Save file

http://simplehtmldom.sourceforge.net/

Looking to parse through an HTML file, make some small changes, and overwrite the current file with the updates. Was wondering if this was possible through simplehtmldom

As of right now, I can access everything, but have no way of displaying the entirely of the HTML With all of the changes included. Is it only possible to grab specific values?

If so, what other methods could I use to accomplish this? I'm afraid the environment I have to work in is extremely limited due to security issues.

The simplehtmldom object can be used as a string, and will just contain the full contents of the modified document.

For example:

echo($html);
file_put_contents($filename, $html);

If you prefer an object-oriented method, you can use save() :

$updated = $html->save();

or

$html->save($filename);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM