1
我在SILEX中存在路由問題。 我有一個的routing.yml通過Silex中的SecurityServiceProvider登錄/註銷
indexGet:
path: /chat
defaults: { _controller: 'resources\controller\StartApp::indexHtml' }
methods: [GET]
indexPost:
path: /chat
defaults: { _controller: 'resources\controller\StartApp::sendMessage'}
methods: [POST]
LoginGet:
path: /login
defaults: { _controller: 'resources\controller\Logins::checkLoginData'}
methods: [GET]
RegisterGet:
path: /register
defaults: { _controller: 'resources\controller\RegisterForm::showReg'}
methods: [GET]
RegisterPost:
path: /register
defaults: { _controller: 'resources\controller\RegisterForm::showReg'}
methods: [POST]
Logout:
path: /logout
defaults: { _controller: 'resources\controller\Logout::logoutFromChat'}
methods: [GET]
這是我的防火牆配置:
$app->register(new Silex\Provider\SecurityServiceProvider());
$app['security.firewalls'] = array(
'chat' => array(
'pattern'=>'/chat',
'anonymous'=>false,
//login_path: before authorisation Check_path: path to check the date of the user
'form'=>array('login_path'=>'/login','check_path' => '/chat/login_check'),
//should realizise the logout
'logout'=>array('logout_path'=>'/chat/logout','invalidate_session'=>true),
'users'=> $app->share(function() use ($app){
return new \resources\controller\UserProvider($app['db']);
})
)
);
的問題是自動路由的登錄和註銷不起作用。你能幫我找到失敗嗎?
正如[文檔](http://silex.sensiolabs.org/doc/providers/security.html)所說,'login_path'應該在防火牆之外,而'login_check'應該在裏面。 – Wndrr