token
This commit is contained in:
@@ -5,6 +5,7 @@ namespace app\controller;
|
||||
use EasyWeChat\Factory;
|
||||
use EasyWeChat\OfficialAccount\Application;
|
||||
use think\facade\Config;
|
||||
use think\facade\Request;
|
||||
use think\facade\Route;
|
||||
use think\facade\View;
|
||||
|
||||
@@ -48,9 +49,12 @@ class Wechat
|
||||
public function code()
|
||||
{
|
||||
$this->initWechat();
|
||||
$user = $this->app->oauth->user();
|
||||
$code = $GLOBALS['data']['data']['code'];
|
||||
$user = $this->app->oauth->userFromCode($code);
|
||||
$user = $this->app->oauth->user();
|
||||
$callback = Request::get('callback');
|
||||
|
||||
$token = '怎样获得一个 token';
|
||||
return redirect($callback.'?token='.$token);
|
||||
|
||||
// $user 可以用的方法:
|
||||
// $user->getId(); // 对应微信的 OPENID
|
||||
// $user->getNickname(); // 对应微信的 nickname
|
||||
|
||||
Reference in New Issue
Block a user