PHP JSON 或数组到 XML [英] PHP JSON or Array to XML

查看:30
本文介绍了PHP JSON 或数组到 XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

获取 JSON 或 Array 对象并将其转换为 XML 的最简单方法是什么.也许我正在寻找所有错误的地方,但我没有找到一个体面的答案来让我走上正轨.这是我必须以某种方式建立自己的东西吗?或者有没有像 json_encode/json_decode 这样的东西,它会接受一个数组或 json 对象,然后把它作为一个 xml 对象弹出?

Whats the easiest way to take a JSON or Array object and convert it to XML. Maybe I am looking in all the wrong places but I am not finding a decent answer to get me on track with doing it. Is this something I would have to somehow build myself? Or is there something like json_encode/json_decode that will take an array or json object and ust pop it out as a xml object?

推荐答案

在此处查看:如何将数组转换为 SimpleXML

这个文档也应该对你有帮助

and this documentation should help you too

关于Json转数组,可以使用json_decode做同样的事情!

Regarding Json to Array, you can use json_decode to do the same!

这篇关于PHP JSON 或数组到 XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆