php yaml 中的空字段
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34089496/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Empty field in yaml
提问by maidi
I want to leave a value in my .yaml field empty, because in another translation there has to be something but not in this one. Just leaving it empty prints out the path of the value (...title.3).
我想在我的 .yaml 字段中留空一个值,因为在另一个翻译中必须有一些东西,但不是这个。只需将其留空即可打印出值的路径 (...title.3)。
title:
1: String
2: String2
3:
回答by Robert
You can use ~
or null
.
您可以使用~
或null
。
You should read documentation of YAMLand you can read Symfony Yaml Formatas well
你应该阅读YAML的文档,你可以阅读的Symfony YAML格式以及
title:
1: String
2: String2
3: ~
回答by Alex von Brandenfels
If you want an empty string, rather than a null value, you can use two single quotes.
如果你想要一个空字符串,而不是一个空值,你可以使用两个单引号。
title:
1: String
2: String2
3: ''