如果你使用 curl 获取的 xml datasimplexml_load_string() 函数把 XML 字符串载入对象中。$xml = simplexml_load_string($xmlStr);$json = json_encode($xml);如果是直接获取 URL 数据的话$xml = simplexml_load_file($data);$json = json_encode($xml);