chenbo преди 4 години
родител
ревизия
7a5e649f85
променени са 2 файла, в които са добавени 6 реда и са изтрити 3 реда
  1. 3 1
      api/login.php
  2. 3 2
      lib/common/weixin_public.class.php

+ 3 - 1
api/login.php

@@ -8,11 +8,13 @@
 try {
 
     $weixin_public = new weixin_public(APPID, APPSECRET, APPURI);
-    $weixin_public->redirectWithCode();
+    $redirectUrl = $weixin_public->redirectWithCode();
+    echo action_msg($redirectUrl, 200);
     exit;
 
 } catch (MyException $e) {
     echo action_msg($e->getMessage(), $e->getCode());
+    exit;
 }
 
 ?>

+ 3 - 2
lib/common/weixin_public.class.php

@@ -39,8 +39,9 @@ class weixin_public
             ."&redirect_uri=".$this->uri
             ."&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";
 
-        header('Location: '.$url);
-        exit;
+        //header('Location: '.$url);
+
+        return $url;
     }
 
     private function getAcessTokenAndOpenId($code)