Пример #1
0
 /**
  * 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;
 }
Пример #2
0
/**
 *
 * xml转array
 */
function xml_to_array($source)
{
    return json_decode(xml_to_json($source), true);
}