/** * 登录 * * @param Request $request * @param Response $response */ public function login(Request $request, Response $response) { $refer = $request->url(); if (!Member::isLogined()) { $token = $request->get('token', ''); if ('' != $token) { //token登录优先,便于测试 $this->tokenLogin($request, $response); } elseif (!Weixin::isWeixinBrowser()) { //不是微信内置浏览器 $this->tips($request, $response); } else { //先用base方式获取微信OAuth2授权,以便于取得openid (new Weixin())->authorizing('http://' . $request->host() . '/user/oauth/weixin?act=login&refer=' . rawurlencode($refer), 'detail'); } } else { $response->redirect($refer); } }