微信网页登录,并且将微信资料存储到数据库
有两种方式设置中间件:
-
设置 middleware 在app/Http/Kernel.php里添加:
/** * The application's route middleware. * * These middleware may be assigned to groups or used individually. * * @var array */ protected $routeMiddleware = [ // ... 'wechat_oauth' => \Goodwong\WechatOAuth\Middleware\OAuthAuthenticate::class, ];
-
直接在web.php的路由规则里添加:
// user auth Route::group([ 'middleware' => [ \Goodwong\WechatOAuth\Middleware\OAuthAuthenticate::class, ], ], function () { // ... });
微信网页登录,并且将微信资料存储到数据库
有两种方式设置中间件:
-
设置 middleware 在app/Http/Kernel.php里添加:
/** * The application's route middleware. * * These middleware may be assigned to groups or used individually. * * @var array */ protected $routeMiddleware = [ // ... 'wechat_oauth' => \Goodwong\WechatOAuth\Middleware\OAuthAuthenticate::class, ];
-
直接在web.php的路由规则里添加:
// user auth Route::group([ 'middleware' => [ \Goodwong\WechatOAuth\Middleware\OAuthAuthenticate::class, ], ], function () { // ... });
在.env文件中,配置以下信息:
- 微信平台
WECHAT_APPID= WECHAT_SECRET=
这些信息可以在开放平台里注册获取