Php Symfony路由配置中的`type:`配置控制什么?
Symfony路由文件中的Php Symfony路由配置中的`type:`配置控制什么?,php,symfony,routing,Php,Symfony,Routing,Symfony路由文件中的类型:配置控制什么?它的有效值是什么 我在任何地方都找不到明确记录的此配置字段。Symfony的书中间接提到了这一点 似乎与其他路线的装载有关。然而,它的行为(或所有允许的值)似乎没有在任何地方明确定义。我可以猜测它会告诉Symfony如何加载外部路由,但我很想知道 我的猜测正确吗 是否存在除目录或注释以外的有效值 这在任何地方都有正式记录吗 Symfony内部是否有一个地方是开始为自己寻找这些答案的好地方 您可以在Symfony中找到该类型的工作方式,请参见下面的代码
类型:
配置控制什么?它的有效值是什么
我在任何地方都找不到明确记录的此配置字段。Symfony的书中间接提到了这一点
似乎与其他路线的装载有关。然而,它的行为(或所有允许的值)似乎没有在任何地方明确定义。我可以猜测它会告诉Symfony如何加载外部路由,但我很想知道
目录
或注释
以外的有效值您可以在Symfony中找到该类型的工作方式,请参见下面的代码。它控制是否应从PHP注释或该(bundle)目录中的YAML或XML文件加载路由
app_file:
# loads routes from the given routing file stored in some bundle
resource: '@AcmeOtherBundle/Resources/config/routing.yaml'
app_annotations:
# loads routes from the PHP annotations of the controllers found in that directory
resource: '../src/Controller/'
type: annotation
app_directory:
# loads routes from the YAML or XML files found in that directory
resource: '../legacy/routing/'
type: directory
app_bundle:
# loads routes from the YAML or XML files found in some bundle directory
resource: '@AppBundle/Resources/config/routing/public/'
type: directory
感谢您的关注@Paweł,+1——然而,根据问题,链接文档的主要文本并没有真正完整地记录
type
的功能——它只列出了两个可能的值示例。我在寻找更具体、更全面的东西。
app_file:
# loads routes from the given routing file stored in some bundle
resource: '@AcmeOtherBundle/Resources/config/routing.yaml'
app_annotations:
# loads routes from the PHP annotations of the controllers found in that directory
resource: '../src/Controller/'
type: annotation
app_directory:
# loads routes from the YAML or XML files found in that directory
resource: '../legacy/routing/'
type: directory
app_bundle:
# loads routes from the YAML or XML files found in some bundle directory
resource: '@AppBundle/Resources/config/routing/public/'
type: directory