参考:https://www.cnblogs.com/unqiang/p/6399136.html
- TOML文件必须是UTF8编码的
- 大小写敏感
- 不关心缩进
字符串:
str1 = "TOML Example"
str2="""The quick brown \
fox jumps over \
the lazy dog.\"""
布尔值:toml的true和false都只支持全小写
bool1 = true
bool2 = false
整数:
int1 = +99
int2 = 42
int3 = 0
int4 = -17
浮点数:
flt1 = +1.0
flt2 = 3.1415
flt6 = -2E-2
日期:
date1 = 1979-05-27T07:32:00Z
date2 = 1979-05-27T00:32:00-07:00
date3 = 1979-05-27T00:32:00.999999-07:00
数组:内容要同一个类型
arr1 = [ 1, 2, 3 ]
arr2 = [ "red", "yellow", "green" ]
arr3 = [ [ 1, 2 ], [3, 4, 5] ]
arr4 = [ "all", 'strings', """are the same""", '''type'''] # this is ok
arr5 = [ [ 1, 2 ], ["a", "b", "c"] ] # this is ok
arr6 = [ 1, 2.0 ] # note: this is NOT ok
[servers]
#你可以使用空格、制表符进行缩进,或者根本不缩进。TOML不关心缩进。
[servers.alpha]
ip = "10.0.0.1"
dc = "eqdc10"
[servers.beta]
ip = "10.0.0.2"
dc = "eqdc10"