PHP addAttribute() 函数
实例
给根元素和 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);
$xml->addAttribute("type","private");
$xml->body->addAttribute("date","2013-01-01");
echo $xml->asXML();
?>
定义和用法
addAttribute() 函数给 SimpleXML 元素添加一个属性。
语法
addAttribute( _name,value,ns_ );
总结
Copyright © 2019- 91mote.com 版权所有
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务