开发者

How does xml editing works in PHP?

If I open a XML file in PHP and edit part 开发者_开发百科of it, does PHP load whole XML content then edit part of it then save whole content back to the file?


It depends on which XML library you are using, but for most of them: yes, they'll load the entire XML into memory (unless you're using XMLReader or XML Parser), and for writing there is XMLWriter which can output XML in portions which you can manually write to a file, the rest will create the string as a whole and can possibly save that to the file directly, or give you the whole string which you can save to a file yourself.

As for saving to file: there is no way PHP can 'edit' a 'portion' of a file. PHP can append to a file, or rewrite the whole file. There is no mechanism I'm aware of that just edits a portion.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜