echo simplexml object

后端 未结 4 2057
失恋的感觉
失恋的感觉 2021-01-14 21:21

This question has two parts.

Part 1. Yesterday I had some code which would echo the entire content of the XML from an RSS feed. Then I deleted it fr

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-14 21:59

    According to the php manual:

    $xml = new SimpleXMLElement($string);
    .
    .
    .
    

    then if you want to echo the result:

    echo $xml->asXML();
    

    or save the xml to a file:

    $xml->asXML('blog.xml'); 
    

    References

    • http://php.net/manual/fr/simplexmlelement.asxml.php

    • http://spotlesswebdesign.com/blog.php?id=14

提交回复
热议问题