配置文件的最佳文件格式是什么 [英] What's Is the Best File Format for Configuration Files

查看:38
本文介绍了配置文件的最佳文件格式是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用 PHP 创建一个框架,需要一些配置文件.其中一些文件不可避免地会有大量条目.

I am creating a framework in PHP and need to have a few configuration files. Some of these files will unavoidably have a large number of entries.

什么格式最适合这些配置文件?

What format would be the best for these config files?

这是我对最佳的量化:

  1. 很容易被 PHP 解析.如果我不必编写任何解析代码就好了,但这不是交易破坏者.
  2. 即使有大量条目,人类也能轻松阅读
  3. 是一个广泛使用的标准,没有自定义格式
  4. 简洁值得赞赏

我开始使用 XML,但由于显而易见的原因很快就放弃了.我想过 JSON 和 YAML,但想看看还有什么.

I started out using XML, but quickly gave up for obvious reasons. I've thought of JSON and YAML but wanted to see what else is out there.

推荐答案

INI 文件格式怎么样?这是事实上的配置文件标准,PHP 内置了该格式的解析器:

How about an INI file format? It's a de facto configuration file standard, and PHP has a built-in parser for that format:

parse_ini_file

这篇关于配置文件的最佳文件格式是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆