Zend application.ini 与 config.ini(或 xml) - 数据库凭证应该去哪里?
我在网上看到了很多代码片段和示例,显示了 Zend_Config
和 application.ini 的不同变体。此外,我还看到过一些关于 ini 配置文件与 xml 配置文件的争论。我个人有一个application.ini和一个config.xml文件。
我的application.ini只有基本的东西,比如php设置和前端控制器设置等
我的config.xml文件有一些站点设置,它还有数据库适配器信息
随着 Zend Framework 的进步,我看到越来越多的人几乎把一切(或者看起来如此) application.ini。我也应该这样做吗?
I have seen a lot of code snippets on the web and examples showing different variations of Zend_Config
and application.ini. Additionally, I have seen some debates about ini config files vs xml config files. I personally have application.ini and a config.xml file.
My application.ini just has basic stuff like php settings and and front controller settings, etc
My config.xml file has some site settings and it also has the db adapter info
As the Zend Framework has progressed I've seen more and more people put almost everything (or so it seems) in application.ini. Should I do the same?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如 @mario 所说,.ini 风格对于凡人来说更具可读性,同时也不太难以编程方式解析。 XML 非常容易解析(在 Java 之类的东西中也是如此),但阅读和导航却很糟糕。除非您确实需要,否则我建议坚持仅使用 .ini 样式文件。您会发现其他人可以更轻松地了解配置“正在做什么”。也就是说,您不会只使用一个配置文件,因此如果有意义的话,可以随意将配置部分分解为多个 .ini 文件。
As @mario says .ini style is way more readable for mortals beings while at the same time being not too bad to parse programatically. XML is wizzy easy for parsing (well it is in stuff like java) but awful to read and navigate through. Unless you really need to I would recommend sticking to just using .ini style files. You'll find it alot easier for other people to get up to speed on what configs 'doing'. That said you aren't stuck to just using one config file so feel free to break down configuration sections into multiple .ini files if it makes sense.