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 守护进程/worker 环境 2022-01-01
- 找不到类“AppHttpControllersDB",我也无法使用新模型 2022-01-01
- 如何在 Symfony 和 Doctrine 中实现多对多和一对多? 2022-01-01
- 在 yii2 中迁移时出现异常“找不到驱动程序" 2022-01-01
- 如何在 XAMPP 上启用 mysqli? 2021-01-01
- 在 CakePHP 2.0 中使用 Html Helper 时未定义的变量 2021-01-01
- phpmyadmin 错误“#1062 - 密钥 1 的重复条目‘1’" 2022-01-01
- 使用 PDO 转义列名 2021-01-01
- Doctrine 2 - 在多对多关系中记录更改 2022-01-01
- HTTP 与 FTP 上传 2021-01-01