[英]php simplexml_load_file and null variable
I have this very simple php code: 我有这个非常简单的php代码:
$xml=simplexml_load_file('abc.xml'); echo $xml;
It shows only blank page, no characters, nothing... Why? 它只显示空白页,没有字符,什么也没有...为什么? Does simplexml_load_file work correctly?
simplexml_load_file是否正常工作?
$xml
is an object. $xml
是一个对象。 You can "visualize" it with 您可以使用
var_dump($xml);
You should read the examples section on simplexml in the PHP documentation : http://php.net/manual/en/simplexml.examples-basic.php to understand how to display specific nodes information. 您应该阅读PHP文档中有关simplexml的示例部分: http : //php.net/manual/en/simplexml.examples-basic.php,以了解如何显示特定的节点信息。
If you want to display the content of your xml directly you can do this : 如果要直接显示xml的内容,可以执行以下操作:
//output xml in your response:
header('Content-Type: text/xml');
echo $xml->asXML();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.