登录表单工作正常,但注销选项没有 这是我使用的代码
$app->register(new Silex\Provider\SecurityServiceProvider(), array(
'security.firewalls' => array(
'admin' => array(
'pattern' => '^/admin',
'form' => array( 'login_path' => '/passport/login', 'check_path' => '/admin/login_check' ),
'logout' => array('logout_path' => 'admin/logout'),
'users' => array(
// raw password is foo
'admin' => array('ROLE_ADMIN', '5FZ2Z8QIkA7UTZ4BYkoC+GsReLf569mSKDsfods6LYQ8t+a8EW9oaircfMpmaLbPBh4FOBiiFyLfuZmTSUwzZg=='),
),
),
)));
$app->run();
然后在管理员的其中一个模板中
<a href="{{path('admin_logout')}}"> Log Out</a>
哪个产生此网址 - / admin / logout
当我点击链接时,我得到Unable to find the controller for path "/admin/logout". The route is wrongly configured
我做错了什么?
答案 0 :(得分:0)
'logout' => array('logout_path' => 'admin/logout')
应该是
'logout' => array('logout_path' => '/admin/logout')
您错过了/
/admin path