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

php – laravel并从注销中删除重定向

发布时间:2020-12-14 19:42:37 所属栏目:大数据 来源:网络整理
导读:我尝试添加一个功能 public function postLogout() { //Auth::logout(); return response()-json(['msg' = 'You have signed out']);} 进入档案 vendorlaravelframeworksrcIlluminateFoundationAuthAuthenticatesUsers.php 并使用一条路线 Route::ge
我尝试添加一个功能

public function postLogout() {
    //Auth::logout();
    return response()->json(['msg' => 'You have signed out']);
}

进入档案

vendorlaravelframeworksrcIlluminateFoundationAuthAuthenticatesUsers.php

并使用一条路线

Route::get('log_out',['as' => 'auth.log_out','uses' => 'AuthAuthController@postLogout']);

如何在这种情况下从url http://localhost/myproj/public/log_out自动重定向?
谢谢

解决方法

什么是自动意味着什么?您想要注销用户并在之后重定向,对吧?您可以在此方案中同时重定向和刷新消息.

Route::get('log_out',function () {
   //Auth::logout();
   return redirect('log_in')->with('status','You have signed out!');
});

阅读更多here

(编辑:李大同)

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

    推荐文章
      热点阅读