php-Laravel 5:重定向到localhost / server外部的外部链接

我想使用laravel 5&我希望DropBox API能够在您登陆首页时(而不是在您单击按钮时)显示API允许/取消警告.
我尝试了不同的方法,但无法使其正常工作.

public function start(){
        session(['user_id'=>1]);
        $dKey = 'key';
        $dSecret = 'secret';
        $appName = 'app';

        $appInfo = new DropBox\AppInfo($dKey,$dSecret);

        //store csrf token
        $tokenStore = new  DropBox\ArrayEntryStore($_SESSION,'dropBox-auth-csrf-token');
        //define auth details
        $this->webAuth = new DropBox\WebAuth($appInfo,$appName,'http://localhost:8000/dropBox/finish',$tokenStore);
        $this->checkSession();
    }

    public function checkSession(){
        $users = User::where('id','=',session('user_id'))->get();

        if(isset($user[0]->dropBox_token)){

        }
        else{
            $url = $this->webAuth->start();

            //return Redirect::to($url);
            //return Redirect::away($url);
            //header('Location : '.$url);
        }

    }

$url中的链接存在并且有效.

这些(最后3条评论方法)是我尝试过的方法,包括return redirect($url),是否可能这样做或我在此浪费时间?请帮助我.

解决方法:

代码我有用:

return redirect()->away('https://www.dropBox.com');

确保您还在start()中添加一个返回值(即return $this-> checkSession();).

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...