request = app('request'); } /** * jsSign签名 * @throws \Exception */ public function index() { $wechat = WechatService::webOauth($this->request->get('mode', 1)); $url = $this->request->server('HTTP_REFERER', $this->request->url(true), null); $assign = [ 'openid' => $wechat['openid'], 'fansinfo' => $wechat['fansinfo'], 'jssdk' => WechatService::webJsSDK($url), ]; return Response::create(env('APP_PATH') . 'wechat/view/api/script/index.js', 'view', 200, [ 'content-type' => 'application/x-javascript;charset=utf-8', 'cache-control' => 'no-cache', 'pragma' => 'no-cache', 'expires' => '0', ])->assign($assign); } }