What#39;s Is the Best File Format for Configuration Files(配置文件的最佳文件格式是什么)
问题描述
我正在用 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?
这是我对最佳的量化:
- 很容易被 PHP 解析.如果我不必编写任何解析代码就好了,但这不是交易破坏者.
- 即使有大量条目,人类也能轻松阅读
- 是一个广泛使用的标准,没有自定义格式
- 简洁值得赞赏
我开始使用 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
这篇关于配置文件的最佳文件格式是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:配置文件的最佳文件格式是什么
基础教程推荐
- php中的PDF导出 2022-01-01
- 如何在数学上评估像“2-1"这样的字符串?产生“1"? 2022-01-01
- 主题化 Drupal 7 的 Ubercart “/cart"页 2021-01-01
- php中的foreach复选框POST 2021-01-01
- php 7.4 在写入变量中的 Twig 问题 2022-01-01
- 使用 scandir() 在目录中查找文件夹 (PHP) 2022-01-01
- 将变量从树枝传递给 js 2022-01-01
- Web 服务器如何处理请求? 2021-01-01
- PHPUnit 的 Selenium 2 文档到底在哪里? 2022-01-01
- Yii2 - 在运行时设置邮件传输参数 2022-01-01
