How to save an XML file on the web server using PHP?

后端 未结 2 1858
北荒
北荒 2021-01-20 23:39

I am a beginner in PHP and I know nothing about XML manipulation. I am working on a Google CSE annotation XML shown below:

  

        
2条回答
  •  后悔当初
    2021-01-21 00:12

    There is nothing wrong with $dom->save("test.xml");.
    You dont need to do the save with DOM though. Could just as well do it with SimpleXML:

    $xml->saveXML("test.xml");
    

    Make sure the destination folder is writable. Use an absolute path to make sure you are actually looking for the file in the right location.

提交回复
热议问题