php - Symfony 路由配置控制中的 `type:` 配置是什么?
问题描述
type:
Symfony 路由文件中的配置控制什么?它的有效值是多少?
我在任何地方都找不到明确记录的这个配置字段。它在 Symfony 的路由文档中被间接引用。
app_directory:
resource: '../legacy/routing/'
type: directory
并且似乎与加载其他路线有关。但是,它的行为(或其所有允许的值)似乎没有在任何地方明确定义。我可以猜测它以某种方式告诉 Symfony如何加载外部路由,但我很想知道
- 我的猜测正确吗?
directory
是否有除or以外的有效值annotation
?- 这是否正式记录在任何地方?
- Symfony 内部是否有一个地方可以作为我自己开始寻找这些答案的好地方?
解决方案
您可以在 Symfony文档中找到该类型的工作原理,请参见下面的代码。它控制是否应从该(捆绑)目录中找到的 PHP 注释或 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
推荐阅读
- elasticsearch - Logstash - 向 Elasticsearch 发送批量请求时出现未知错误
- css - 背景位置:x%如何与背景图像一起使用?
- xpath - Orbeon:为重复网格中的每一行添加部分
- python - 如何更改 LDA 中的默认 number_words
- javafx - SelectionMode.MULTIPLE 与 TAB 导航到下一个单元格
- css - Bootstrap 4:列固定宽度+卡片页脚中的其余行
- asp.net - 使用 asp.net 的批量电子邮件发送问题
- tensorflow - stride=2 的 2x2 deconv 内核如何工作?
- javascript - 如何转换从时间戳创建的日期为 yyyy-MM-dd 格式
- ibm-cloud - 在 Watson IoT 中使用 IBM Cloud 获取其他设备令牌值