FOS 用户 /register 路径在 url 中有效但不是路径
FOS user /register path works in url but not as a path
我正在为用户帐户使用 Doctrine 和 FOS 制作一个 symfony 项目。
我有路径 http://localhost:8000/register/
正常工作并显示我的页面。
但是,如果我将它添加为树枝中的路径,如下所示:
<p><a href="{{ path('register') }}">No Account? Register here!</a></p>
我收到这个错误
An exception has been thrown during the rendering of a template ("Unable to >generate a URL for the named route "/register" as such route does not exist.").
我的 routing.yml
中已经有了所有需要的信息
app:
resource: "@AppBundle/Controller/"
type: annotation
fos_user:
resource: "@FOSUserBundle/Resources/config/routing/all.xml"
fos_user_security:
resource: "@FOSUserBundle/Resources/config/routing/security.xml"
fos_user_profile:
resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
prefix: /profile
fos_user_register:
resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
prefix: /register
fos_user_resetting:
resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
prefix: /resetting
fos_user_change_password:
resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
prefix: /profile
这可能是什么问题,我该如何解决?
根据 @FOSUserBundle/Resources/config/routing/registration.xml
路线命名为 fos_user_registration_register
。
所以 {{ path('fos_user_registration_register') }}
应该可以。
我正在为用户帐户使用 Doctrine 和 FOS 制作一个 symfony 项目。
我有路径 http://localhost:8000/register/
正常工作并显示我的页面。
但是,如果我将它添加为树枝中的路径,如下所示:
<p><a href="{{ path('register') }}">No Account? Register here!</a></p>
我收到这个错误
An exception has been thrown during the rendering of a template ("Unable to >generate a URL for the named route "/register" as such route does not exist.").
我的 routing.yml
中已经有了所有需要的信息app:
resource: "@AppBundle/Controller/"
type: annotation
fos_user:
resource: "@FOSUserBundle/Resources/config/routing/all.xml"
fos_user_security:
resource: "@FOSUserBundle/Resources/config/routing/security.xml"
fos_user_profile:
resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
prefix: /profile
fos_user_register:
resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
prefix: /register
fos_user_resetting:
resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
prefix: /resetting
fos_user_change_password:
resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
prefix: /profile
这可能是什么问题,我该如何解决?
根据 @FOSUserBundle/Resources/config/routing/registration.xml
路线命名为 fos_user_registration_register
。
所以 {{ path('fos_user_registration_register') }}
应该可以。