Symfony FOSUserBundle';s登录表单';从网络地址中找不到的路由
在Windows 10的WampServer上使用Symfony(使用FOSUserbundle)进行开发 我必须通过本地网络IP(而不是计算机的本地IP,即127.0.0.1)访问我的应用程序,因为在注册/身份验证过程中的某个时刻,必须调用外部(国家)身份验证服务 除了FOSUserBundle的登录表单之外,我的应用程序在使用时运行良好。使用时会显示例外页面,但使用时会显示例外页面 找不到“GET/login/”的路由 某些配置: security.yml 路由.yml app_dev.phpSymfony FOSUserBundle';s登录表单';从网络地址中找不到的路由,symfony,fosuserbundle,Symfony,Fosuserbundle,在Windows 10的WampServer上使用Symfony(使用FOSUserbundle)进行开发 我必须通过本地网络IP(而不是计算机的本地IP,即127.0.0.1)访问我的应用程序,因为在注册/身份验证过程中的某个时刻,必须调用外部(国家)身份验证服务 除了FOSUserBundle的登录表单之外,我的应用程序在使用时运行良好。使用时会显示例外页面,但使用时会显示例外页面 找不到“GET/login/”的路由 某些配置: security.yml 路由.yml app_dev.ph
如何使用登录表单我通过编辑main routing.yml使此页面正常工作,如下所示:
(...)
fos_user_manual:
path: '/login/'
defaults: { _controller: FOSUserBundle:Security:login }
fos_user:
resource: "@FOSUserBundle/Resources/config/routing/all.xml"
如果尝试路径:'/login'
,但该路径无效
因此,这似乎是可行的,如果有更干净的解决方案,我仍然欢迎评论或建议。您可以查看
php应用程序/console debug:router
,因为该路由在本地工作,我不希望在这里发现任何问题。我刚检查过,但你希望它能显示什么?
app:
resource: '@AppBundle/Controller/'
type: annotation
singlesingon_view:
path: '/authentication/singlesignon/'
defaults: { _controller: AppBundle:AuthenticationSingleSignOn:view }
singlesingout_view:
path: '/authentication/singlesignout/'
defaults: { _controller: AppBundle:AuthenticationSingleSignOut:view }
fos_user:
resource: "@FOSUserBundle/Resources/config/routing/all.xml"
if (isset($_SERVER['HTTP_CLIENT_IP'])
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|| !(in_array(@$_SERVER['REMOTE_ADDR'],['[my_network_ip]','127.0.0.1', '::1'], true) || PHP_SAPI === 'cli-server')
) {
header('HTTP/1.0 403 Forbidden');
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}
(...)
fos_user_manual:
path: '/login/'
defaults: { _controller: FOSUserBundle:Security:login }
fos_user:
resource: "@FOSUserBundle/Resources/config/routing/all.xml"