Cannot access XML Document using simplexml_load_file()

前端 未结 1 532
我寻月下人不归
我寻月下人不归 2021-01-29 11:01

I NEED HELP! I\'m trying to generate XML document from my website database in hosting provider and accessing it from my home PC, right now I\'m doing it in localhost environment

相关标签:
1条回答
  • 2021-01-29 11:47

    Your print_r($dataxml = simplexml_load_file('data.php')); is reading you raw PHP file, not the script execution result!

    data.php file have a PHP code that outputs a XML file, not a really XML file.

    You should use print_r($dataxml = simplexml_load_file('http://localhost/data.php')); for example. (Assuming that http://localhost/data.php is the url to access your file.)

    using only 'data.php' as parameter will get the raw file from server, not processed by PHP.

    0 讨论(0)
提交回复
热议问题