<div class="codetitle"><a style="CURSOR: pointer" data="67797" class="copybut" id="copybut67797" onclick="doCopy('code67797')"> 代码如下:<div class="codebody" id="code67797"> //xml string $xml_string="<?xml version='1.0'?> Foo foo@bar.com Foobar foobar@foo.com "; //load the xml string using simplexml $xml = simplexml_load_string($xml_string); //loop through the each node of user foreach ($xml->user as $user) { //access attribute echo $user['id'],' '; //subnodes are accessed by -> operator echo $user->name,' '; echo $user->email,' '; }
这里是摘自编程之家之前发布的文章。更多的技巧可以参考。 收集的二十一个实用便利的PHP函数代码
(编辑:李大同)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|