$data = simplexml_load_string($res, 'SimpleXMLElement', LIBXML_NOCDATA);
$arr = converArray($data); function converArray($xmlData)
{
foreach((array)$xmlData as $val=>$key)
{
if(!is_string($key))
{
$arr =converArray($key);
$list[$val] = $arr;
}
else
{
$list[$val] = $key;
}
}
return $list;
}

  

xml装php数组的更多相关文章

  1. 分享一个解析XML成为php数组的方法

    原文:分享一个解析XML成为php数组的方法 <?php /* * To change this template, choose Tools | Templates * and open th ...

  2. 数组转xml格式/xml格式转数组

    数组转xml格式 $arr=array( 'username'=>'huahua', 'password'=>'123456', 'number'=>'15889652911', ) ...

  3. XML转换成数组方法

    <?php function xmlToArray2($xml) { // 将XML转为array $array_data = json_decode(json_encode(simplexml ...

  4. php xml字符串转数组

    function xmltoarr($path){//xml字符串转数组 $xmlfile = file_get_contents($path);//提取xml文档中的内容以字符串格式赋给变量 $ob ...

  5. 将xml转换为PHP数组

    这里提供一个类来将XML转换为PHP数组,下面是类的代码 <?php/** * XML2Array: A class to convert XML to array in PHP * It re ...

  6. 微信开发所需要的的方法(签名认证、数组转字符串方法、将xml字符串转换为数组、发送xml请求方法)

    //将xml字符串转换为数组 public function xmlToArray($xml){ $array_data = json_decode(json_encode(simplexml_loa ...

  7. xml字符串,xml对象,数组之间的相互转化

    <?phpnamespace Home\Controller;use Think\Controller;class IndexController extends Controller { pu ...

  8. 一个简单xml数据转换为数组的方法

    本人用easywechat做微信回复图文,从数据库中拿到的数据直接是xml拼好的数据,但是框架只有自带的获取xml格式的语句,所有需要将xml数据中所需要的数据拿出来用来拼接. 搜了好多资料说的都很麻 ...

  9. PHP将XML转成数组

    如果你使用 curl 获取的 xml data$xml = simplexml_load_string($data);$data['tk'] = json_decode(json_encode($xm ...

随机推荐

  1. Forbidden You don't have permission to access / on this server. You don't have permission to access /phpmyadmin/ on this server. 解决办法

    Forbidden  You don't have permission to access / on this server.   解决办法 打开 httpd.conf 文件, 将 #   onli ...

  2. access denied ("java.net.SocketPermission" "localhost:1527" "listen,resolve")

    在开启derby服务出现该错误(测试hibernate 连接数据库时  使用myeclipse2014自带的数据库--windows->show view->other->Myecl ...

  3. vitamio框架

    import io.vov.vitamio.LibsChecker; import io.vov.vitamio.MediaPlayer; import io.vov.vitamio.MediaPla ...

  4. 键盘控制div移动

    <!DOCTYPE html><html lang="zh-CN"><head> <meta charset="UTF-8&qu ...

  5. 有关使用Maven常见问题总结(Eclipse中使用Maven、Maven项目部署到tomcat等问题)

    http://blog.csdn.net/sunitjy/article/details/42709311 ********************************************** ...

  6. PHP_解析xss攻击、sql注入

    /** * PHP解决XSS(跨站脚本攻击)的调用函数 * PHP跨站脚本漏洞补丁,去除XSS(跨站脚本攻击)的函数,把以下代码保存在function.php文件中,在需要防御的页面中include ...

  7. PCA in Bioinformatics

    光看原理和代码是没用的,得看看具体算法在实际中的用途,多看看文献. Principal component analysis for clustering gene expression data

  8. html5中插入视频和音频

    <audio src="1.mp3" controls></audio> <video src="1.mp4" controls& ...

  9. 在Windows8.1中通过IIS发布网站产生HTTP Error 503错误的解决方案

    1.解决IIS下网站Bin目录中32位DLL不能使用,如图所示 2.解决通过IIS浏览网站,出现Http503的问题,如图所示

  10. [转载]Badboy使用教程

    Badboy-系列教程-资料整理: Badboy自动化测试工具1 界面介绍 http://leafwf.blog.51cto.com/872759/1107079 Badboy自动化测试工具2 录制 ...