php _construct() 函数
实例
函数创建一个新的 simplexmlelement 对象,然后输出 body 节点的内容:
<?php $note=<<<xml <note> <to>tove</to> <from>jani</from> <heading>reminder</heading> <body>don't forget me this weekend!</body> </note> xml; $xml=new simplexmlelement($note); echo $xml->body; ?>
[运行实例»](/try/showphp.php?filename=demo_func_simplexml_construct)
定义和用法
_construct()
函数创建一个新的 simplexmlelement 对象。
语法
_construct( _data,options,data_is_url,ns,is_prefix_ );
假设我们有如下的 xml 文件,"note.xml":
<?xml version="1.0" encoding="iso-8859-1"?> <note> <to>tove</to> <from>jani</from> <heading>reminder</heading> <body>don't forget me this weekend!</body> </note>
实例 1
从 url 中创建一个 simplexmlelement 对象:
<?php $xml=new simplexmlelement("note.xml",null,true); echo $xml->asxml(); ?>
总结
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对移动技术网的支持。如果你想了解更多相关内容请查看下面相关链接
如对本文有疑问, 点击进行留言回复!!
php 使用 yansongda/pay 进行微信,支付宝支付
Codeforces Round #658 (Div. 2) (C1、C2)
van-uploader + thinkphp6.0 图片上传
网友评论