我想在我的.yaml字段中保留一个空值,因为在另一个翻译中必须有一些东西但不在这个中.把它留空是打印出值的路径(... title.3).
title:
1: String
2: String2
3:
Run Code Online (Sandbox Code Playgroud)
Ale*_*els 38
如果您想要一个空字符串而不是空值,则可以使用两个单引号.
title:
1: String
2: String2
3: ''
Run Code Online (Sandbox Code Playgroud)
Rob*_*ert 33
你可以使用~
或null
.
你应该阅读YAML的文档,你可以阅读的Symfony YAML格式以及
title:
1: String
2: String2
3: ~
Run Code Online (Sandbox Code Playgroud)
根据YAML v1.2 规范:
10.3.2. 标签解析
Run Code Online (Sandbox Code Playgroud)Regular expression Resolved to tag null | Null | NULL | ~ tag:yaml.org,2002:null /* Empty */ tag:yaml.org,2002:null
因此,放置null
或~
省略 value 会产生相同的结果tag:yaml.org,2002:null
::
parent:
key1: # empty so "null", # is a comment!
key2: ~ # also "null"
key3: null # "null" explicitly ))
key4: !!null "null" # for the funs of "secondary tag handle: !!"
key5: "null" # sorry, it is a string or !!str if you like ((
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
34844 次 |
最近记录: |