如果用户点击CANCEL
按钮,当基本身份验证对话框出现时,如何将FatFree重新路由到我想要的任何页面?
我试过 -
if (! $auth->basic()){
$this->f3->reroute('/');
}
但这不起作用。页面显示消息:
Unauthorized
HTTP 401 (GET /protected-url)
答案 0 :(得分:0)
在$ f3 bootstrap中重新路由index.php可以像这样使用:
//logoutfrom forum
$f3->route('GET /logout',
function($f3)
{
$f3->clear('SESSION');
session_commit();
$f3->reroute('/loggedout');
//where loggedout is a view
}
);
Also i was going to use basic auth but in fact found the none basic better; you an then just use something like:
if ($f3->get('SESSION.user_name')== NULL )
{
$f3->reroute('/inform/notauthorised');
}
//where notauthorised is a view