简体   繁体   中英

Zend application.ini vs config.ini (or xml) - where should db credentials go?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM