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


基础教程推荐
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- 如何替换eregi() 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01