/** * Decode a request result. * * @param $body * @return mixed */ private function decode($body) { if (is_json($body)) { return json_decode($body, true); } if (is_xml($body)) { return xml_to_json($body); } return $body; }
/** * * xml转array */ function xml_to_array($source) { return json_decode(xml_to_json($source), true); }