开发者

Hot to add xml tag at the start of file and at the end

I've got broken data.xml file, how i can fix it with php? I need to add at the beginning of the file two lines

<?xml version="1.0" encoding="UTF-8"?>
<archive>
...<xml data>...

And at the end of the file

</archive>

Does anyone have any ideas or solutions how to 开发者_运维问答add and save xml structure?


This is sort of an incomplete questions... Are you writing a script to run on the command-line and work with files? Handling uploaded files?

In general just treat the file as a text file. You can make a new file, write your new first two lines, then output the contents of your data.xml file, then write the last line. It's just text.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜