php - DOM 和文件获取内容

php - DOM and file get content

usage/usability、"file_get_content" 或 "DOM LoadHtmlFile" 哪个最适合性能?

由于他们都获得 html 内容,使用其中一个的最佳情况是什么?

这也与 "file_put_content" 和 "DOM SaveHtmlFile"

发这个问题的时候我还是菜鸟。这是我写这篇文章时的结论,

they both do different things completely. "DOM LoadHtmlFile" is a part of a DOMDocument class which is very powerful to manipulate html formatted content, and file_get_content is used to get file/http content as a string and manipulate as your wish. On a case scenario if the target content are in html format, depending on needs, if requires heavily change then I would personally use DomDocument class. If otherwise, I would just manipulate as a string.