加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

Laravel5:在RouteCollection.php中重定向:: to()外链接NotFound

发布时间:2020-12-14 19:43:01 所属栏目:大数据 来源:网络整理
导读:我正在开发一个Laravel 5应用程序,我有这条路线 Route::get('/go','UrlController@index'); 在这个UrlController.php中,我有这个索引方法 public function index(){ return Redirect::to('www.google.com',302);} 当我测试这个url http:// localhost:8000
我正在开发一个Laravel 5应用程序,我有这条路线

Route::get('/go','UrlController@index');

在这个UrlController.php中,我有这个索引方法

public function index(){
    return Redirect::to('www.google.com',302);
}

当我测试这个url http:// localhost:8000 / go
?它只是更改为http:// localhost:8000 / www.google.com并在RouteCollection.php第161行中出现此错误NotFoundHttpException
那么问题是什么,谢谢

解决方法

你应该在www.google.com之前添加协议

public function index(){
    return Redirect::to('https://www.google.com',302);
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读