您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息
三六零分类信息网 > 白银分类信息网,免费分类信息发布

PHP如何将XML转成数组,phpxml数组_PHP教程

2024/4/2 18:05:29发布19次查看
php如何将xml转成数组,phpxml数组如果你使用 curl 获取的 xml data
xml=simplexmlloadstring(data);
data[′tk′]=jsondecode(jsonencode(xml),true);
如果是直接获取 url 数据的话
xml=simplexmlloadfile(data);
data[′tk′]=jsondecode(jsonencode(xml),true);
先把 simplexml 对象转换成 json,再将 json 转换成数组。
代码:
<?php$string = < string 'joe' (length=3) public 'to' => string 'jane' (length=4) public 'body' => string ' i know that's the answer -- but what's the question? ' (length=57)array 'title' => string 'forty what?' (length=11) 'from' => string 'joe' (length=3) 'to' => string 'jane' (length=4) 'body' => string ' i know that's the answer -- but what's the question? ' (length=57)
以上就是本文的全部内容,希望对大家的学习有所帮助。
您可能感兴趣的文章:php下将xml转换为数组php中将数组转成xml格式的实现代码php之xml转数组函数的详解php将xml转数组过程详解php中array2xml类实现数组转化成xml实例php实现将数组转换为xml的方法递归实现php数组转xml的代码分享
http://www.bkjia.com/phpjc/1117026.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/1117026.htmltecharticlephp如何将xml转成数组,phpxml数组 如果你使用 curl 获取的 xml data xml=simplexmlloadstring(data); data[′tk′]=jsondecode(jsonencode(xml),true); 如果是直接获取...
白银分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录