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
这篇关于配置文件的最佳文件格式是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:配置文件的最佳文件格式是什么


- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- PHP foreach() 与数组中的数组? 2022-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01
- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- 覆盖 Magento 社区模块控制器的问题 2022-01-01
- PHP - if 语句中的倒序 2021-01-01