simplexml_load_file(file,classname,options,ns,is_prefix);
它用于将简单的XML文件转换为SimpleXMLElement对象。
Sr.No | 参数 & Description |
---|---|
1 |
file 它用于指定XML文件的路径 |
2 |
classname 用于指定新对象的类 链接:https://www.learnfk.comhttps://www.learnfk.com/php/php-simplexml-load-file.html 来源:LearnFk无涯教程网 |
3 |
ns 它用于指定命名空间前缀或URI |
4 |
is_prefix 它用于指定布尔值,如果result为true而不是ns is prefix,否则给出的结果为false |
成功时返回SimpleXMLElement对象,失败时返回False
<?php $xml=simplexml_load_file("sample.xml"); print_r($xml); ?>
这将产生以下结果-
SimpleXMLElement Object ( [to] => gopal [from] => CEO [heading] => Reminder [body] => Don't forget to send a file to me )
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)