diff --git a/WeChat/Media.php b/WeChat/Media.php index 684b568..33f9a69 100644 --- a/WeChat/Media.php +++ b/WeChat/Media.php @@ -56,8 +56,8 @@ class Media extends BasicWeChat $url = "https://api.weixin.qq.com/cgi-bin/media/get?access_token=ACCESS_TOKEN&media_id={$media_id}"; $this->registerApi($url, __FUNCTION__, func_get_args()); $result = Tools::get($url); - if (($json = Tools::json2arr($result))) { - return $json; + if (json_decode($result)) { + return Tools::json2arr($result); } return is_null($outType) ? $result : $outType($result); } @@ -139,8 +139,8 @@ class Media extends BasicWeChat $url = "https://api.weixin.qq.com/cgi-bin/material/get_material?access_token=ACCESS_TOKEN"; $this->registerApi($url, __FUNCTION__, func_get_args()); $result = Tools::post($url, ['media_id' => $media_id]); - if (($json = Tools::json2arr($result))) { - return $json; + if (json_decode($result)) { + return Tools::json2arr($result); } return is_null($outType) ? $result : $outType($result); } diff --git a/WeMini/Qrcode.php b/WeMini/Qrcode.php index aa70129..a271712 100644 --- a/WeMini/Qrcode.php +++ b/WeMini/Qrcode.php @@ -43,8 +43,8 @@ class Qrcode extends BasicWeChat $this->registerApi($url, __FUNCTION__, func_get_args()); $data = ['path' => $path, 'width' => $width, 'auto_color' => $auto_color, 'line_color' => $line_color]; $result = Tools::post($url, Tools::arr2json($data)); - if (($json = Tools::json2arr($result))) { - return $json; + if (json_decode($result)) { + return Tools::json2arr($result); } return is_null($outType) ? $result : $outType($result); } @@ -68,8 +68,8 @@ class Qrcode extends BasicWeChat $data = ['scene' => $scene, 'width' => $width, 'auto_color' => $auto_color, 'page' => $page, 'line_color' => $line_color]; $this->registerApi($url, __FUNCTION__, func_get_args()); $result = Tools::post($url, Tools::arr2json($data)); - if (($json = Tools::json2arr($result))) { - return $json; + if (json_decode($result)) { + return Tools::json2arr($result); } return is_null($outType) ? $result : $outType($result); } @@ -89,8 +89,8 @@ class Qrcode extends BasicWeChat $url = 'https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=ACCESS_TOKEN'; $this->registerApi($url, __FUNCTION__, func_get_args()); $result = Tools::post($url, Tools::arr2json(['path' => $path, 'width' => $width])); - if (($json = Tools::json2arr($result))) { - return $json; + if (json_decode($result)) { + return Tools::json2arr($result); } return is_null($outType) ? $result : $outType($result); }