从 SimpleXMLObject 到数组的递归转换
我需要递归地将 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);
相关文章