Php Symfony路由关键字
我对Symfony路线很困惑 我有这个文件,下面,我不能理解不同的关键字。例如,我不知道“前缀”或“模式”是如何工作的 模式(或路径)是将附加到根域的url路径(请参阅) 前缀将是添加到“资源”中包含的所有路由的模式(请参阅) 例如Php Symfony路由关键字,php,symfony,Php,Symfony,我对Symfony路线很困惑 我有这个文件,下面,我不能理解不同的关键字。例如,我不知道“前缀”或“模式”是如何工作的 模式(或路径)是将附加到根域的url路径(请参阅) 前缀将是添加到“资源”中包含的所有路由的模式(请参阅) 例如 fos_user_profile: resource: "@FOSUserBundle/Resources/config/routing/profile.xml" prefix: /profile 正在加载前缀为/profile的资源@FOSUse
fos_user_profile:
resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
prefix: /profile
正在加载前缀为/profile
的资源@FOSUserBundle/Resources/config/routing/profile.xml
,这意味着包含的路由将以该“前缀”作为前缀
例如@FOSUserBundle/Resources/config/routing/profile.xml
有以下路径
fos_user_profile_edit:
pattern: /edit
defaults:
_controller: FOSUserBundle:Profile:edit
但是使用前缀/profile
时,其完整路径(前提是父路由文件中没有其他前缀)将位于/profile/edit
,而不仅仅是/edit阅读文档:
fos_user_profile_edit:
pattern: /edit
defaults:
_controller: FOSUserBundle:Profile:edit