如果你使用 curl 获取的 xml data $xml = simplexml_load_string($data); $data['tk'] = json_decode(json_encode($xml),TRUE); 如果是直接获取 URL 数据的话 $xml = simplexml_load_file($data); $data['tk'] = json_decode(json_encode($xml),TRUE); 先把 simplexml 对象转换成 json,再将 json 转换成数组。 |
GMT+8, 2024-5-20 17:59 , Processed in 0.056870 second(s), 10 queries , Xcache On.
Powered by Discuz! X3.2
© 2001-2013 Comsenz Inc.