Php 重定向到SilverStripe';s页
我正在尝试在我的SilverStripe站点上设置重定向 我已经创建了自己的模块,现在我希望用户在登录后重定向到该模块 我试过使用Php 重定向到SilverStripe';s页,php,silverstripe,Php,Silverstripe,我正在尝试在我的SilverStripe站点上设置重定向 我已经创建了自己的模块,现在我希望用户在登录后重定向到该模块 我试过使用Director::redirect($Url\u base.'myModule'),但不起作用 有人有什么建议吗?试试这个:试试这个:我做了这样的事情: class MyLoginForm extends MemberLoginForm { public function dologin($data) { parent::dologin($d
Director::redirect($Url\u base.'myModule')
,但不起作用
有人有什么建议吗?试试这个:试试这个:我做了这样的事情:
class MyLoginForm extends MemberLoginForm {
public function dologin($data) {
parent::dologin($data);
if (Director::redirected_to() && $Member = Member::currentUser()) {
$this->controller->response->removeHeader('Location');
if ($Member->Email == 'admin') {
$destination = '/admin';
} else {
$destination = '/user/' . $Member->Username;
}
Director::redirect($destination);
}
}
}
如果是管理员用户,我将其重定向到
/admin
。如果是另一个用户,我会将他们重定向到/user/username
我做了如下操作:
class MyLoginForm extends MemberLoginForm {
public function dologin($data) {
parent::dologin($data);
if (Director::redirected_to() && $Member = Member::currentUser()) {
$this->controller->response->removeHeader('Location');
if ($Member->Email == 'admin') {
$destination = '/admin';
} else {
$destination = '/user/' . $Member->Username;
}
Director::redirect($destination);
}
}
}
如果是管理员用户,我将其重定向到
/admin
。如果是另一个用户,我会将他们重定向到/user/username
Ed,我想我们需要更多信息来帮助您。模块在哪里,前端还是后端?我们讨论的是与模块不同的页面类型,还是新的管理界面?Ed我想我们需要更多信息来帮助您。模块在哪里,前端还是后端?我们讨论的是与模块不同的页面类型,还是新的管理界面?