PHP 和 Perl 共享的好的纯文本配置文件格式是什么?

发布于 2024-10-03 04:30:51 字数 201 浏览 0 评论 0原文

这更多的是一个概念问题,而不是一个需要解决的编码问题。 我们有许多 PHP 和 Perl 脚本。

公司各处分布着大量 MySQL 服务器,每个服务器都有大量不同的用户/权限组合。

我想创建一个中央配置文件,可能是纯文本文件,其中包含所有连接数据的列表。每种语言都需要能够读取文件并将其解析为可用的格式。

我想知道实现此目的的任何首选方法。

This is more of a concept question rather than a coding problem to be solved.
We have a number of scripts in both PHP and Perl.

There are a large number of MySQL servers spread around the company each with a large subset of different user/permission combos.

I would like to create a central configuration file, maybe as plain text file, that has a list of all the connection data. Each language would need to be able to read the files and parse them into a usable format.

I would like to know any preferred method of implementing this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

若言繁花未落 2024-10-10 04:30:51

选择 inixmlyamljson。 Perl 和 PHP 中有一些库可以处理这些格式。

Pick any of ini, xml, yaml or json. There are libraries for working with any of these formats in Perl and PHP.

要走干脆点 2024-10-10 04:30:51

对于 PHP,您有 parse_ini_file,对于 Perl,您有 Config::INI::Reader。这两者都应该可以很好地满足您的需要,并允许人类轻松编辑的结构化配置。

For PHP you have parse_ini_file and for Perl you have Config::INI::Reader. Both of these should do you pretty fine and allow structured configuration that's easily editable by humans.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文