YAML中波浪号字符〜的目的是什么? [英] What is the purpose of tilde character ~ in YAML?
问题描述
我查看了 YAML 官方文档,也浏览了一些教程.
I have looked into YAML official documentation and I have also gone through some tutorials.
我正在使用 Symfony,我喜欢使用 YAML 添加配置.但是我在 YAML 中找不到这个波浪号字符 ~
的任何解释.
I am working with Symfony and I like adding configurations with YAML. But I can't find any explanation for this tilde character ~
in YAML.
例如看下面的代码:
firewalls:
# ...
main:
anonymous: ~
http_basic: ~
有时,我删除了这个 ~ 字符,但我没有看到对逻辑有任何影响.那么YAML中这个潮汐字符的目的是什么?
Sometimes, I removed this ~ character and I did not see any effect on logic. So what is the purpose of this tide character in YAML?
推荐答案
波浪号是写入空值的一种方式.大多数解析器也接受 null 的空值,当然还有 null
、Null
和 NULL
.
The tilde is one of the ways the null value can be written. Most parsers also accept an empty value for null, and of course null
, Null
and NULL
.
这些是在核心架构标签的正则表达式的前两行中定义的 在 YAML 标准中.
These are defined in the first two lines of the regular expressions for the core schema tags in the YAML standard.
这篇关于YAML中波浪号字符〜的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!