YAML
-
文件以
.yaml
或者.yml
结尾 -
缩进来表示层级关系,
#
表示注释 -
数据类型
-
纯量:不可在分的值例如
str
,bool
,int
,float
,Null
,time
,date
name: game version: 1.0 port: 4918 stdin: true image: ~ date: 2022-07-07 time: 2022-07-07T08:30:10+08:00 # 这个就是可以弄多行出来 singleLineString: > this is a very long string another line # 在这种情况下换行符就替换成空格,但是最后一个换行符会保留,如果想要去掉最后一个换行符 # 就使用 singleLineString: >- # 这句话解析出来就是: "this is a very long string another line\n" # 如果想要每一行最后都是换行符就: multiLine: | this is a very long string another line # 这句话解析出来就是: "this is a very long string\nanother line\n"
-
数组:数组是以
-
开头的# 也就是markdown的无序列表 ports: - 4399 - 5210 # 也可以写成下面的样子 ports: [4399, 5210]
-
对象
container: name: edge port: 1234 version: 4.6 # 缩进相同就行了
-