V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  anviod  ›  全部回复第 10 页 / 共 10 页
回复总数  182
1  2  3  4  5  6  7  8  9  10  
2017-01-10 12:00:17 +08:00
回复了 xx19941215 创建的主题 PHP laravel 5.3 自定义登陆成功后的跳转路由无效?
@xx19941215
<?php

namespace Illuminate\Foundation\Auth;

trait RedirectsUsers
{
/**
* Get the post register / login redirect path.
*
* @return string
*/
public function redirectPath()
{
if (method_exists($this, 'redirectTo')) {
return $this->redirectTo();
}

return property_exists($this, 'redirectTo') ? $this->redirectTo : '/home';
}
}

若自定义 redirectTo 成员函数 需要返回值为 string 类型。
可以这样写
protected function redirectTo()
{
// die('ok');
return '/index';
}
2017-01-08 22:21:11 +08:00
回复了 xx19941215 创建的主题 PHP laravel 5.3 自定义登陆成功后的跳转路由无效?
默认不给参数 就是自动跳转到 /home
去看 Illuminate\Foundation\Auth\RedirectsUsers;
第十八行

return property_exists($this, 'redirectTo') ? $this->redirectTo : '/home';
1  2  3  4  5  6  7  8  9  10  
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   2763 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 11ms · UTC 13:00 · PVG 21:00 · LAX 05:00 · JFK 08:00
♥ Do have faith in what you're doing.