什么是单句点/点“。”在 YAML 中是什么意思?

What does the single period / dot "." in YAML means?

谁能解释一下 YAML 中单个点 (.) 的含义。以下是 YAML 中的配置文件:

api_platform:
  resource: .
  type: api_platform
  prefix: /api

以上资源键有一个 . 值。

句点 (.) 在 YAML 上没有内在含义,因为 nothing 在 YAML 上没有任何内在含义。

单句号简单表示“包含.”的字符串.

只有进行处理的应用程序才能赋予 YAML 内容任何意义。就 YAML 解析器而言,YAML 文档有效或无效,是否代表某种结构;但这并不意味着意思

在 Symfony 路由组件的上下文中(您显示的配置 belongs to that component), how that specific period is interpreted it depends on the route loader being used,在本例中是 api_platform 加载程序。

您可以在 api-platform/core/src/Bridge/Symfony/Routing/ApiLoader.php 上找到的这个路由加载程序对 resource 键没有用处。它根本没有用在 class 上。

如此有效,句号毫无意义。它存在只是因为它是路由组件所需的配置密钥。