我需要递归地将 PHP SimpleXMLObject 转换为数组.问题是每个子元素也是一个 PHP SimpleXMLElement.
I need to recursively cast a PHP SimpleXMLObject to an array. The problem is that each sub element is also a PHP SimpleXMLElement.
这可能吗?
json_decode(json_encode((array) simplexml_load_string($obj)), 1);
这篇关于从 SimpleXMLObject 到数组的递归转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!