常见的配置文件格式

COS、CDN
  1. INI格式

    [database] host = localhost port = 3306 user = root password = secret
  2. JSON格式

    {   "database": {     "host": "localhost",     "port": 3306,     "user": "root",     "password": "secret"   } }
  3. XML格式

    <configuration>   <database>     <host>localhost</host>     <port>3306</port>     <user>root</user>     <password>secret</password>   </database> </configuration>
  4. YAML格式

    database:   host: localhost   port: 3306   user: root   password: secret
  5. Properties格式

    database.host=localhost database.port=3306 database.user=root database.password=secret

选择哪种格式取决于具体的应用场景和个人偏好,每种格式都有其适用性和局限性。

COS、CDN
热门