I am exploring the benefits of Zend_Config_Ini compared to using a simple constant file.
eg. -
define('DB_HOST',localhost); //versus $config = new Zend_Config_Ini('/path/to/config.ini', 'staging'); echo $config->database->params->host; // prints "dev.example.com"
The only thing is that $ config is not globally accessible. So, you need to use Zend_Registry to store applications, without having to run it every time.
This seems to add more complexity than necessary .... Am I missing something or is Zend_Config + Zend_Registry a method that is better in the long run as the application grows?
- . , lib , lib DB_HOST. .
, Zend Framework . Zend_Db - . $this->database, , , .
Zend_Db
$this->database
, . . Fowler.
Zend_Config , " PHP"; .ini - .ini PHP-.
Zend_Config
.ini/XML - /!
.ini Zend_Config , ; , (.. "" "" "", )
, Zend_Config, : Zend Framework Zend_Application , ; ? ?
Zend_Application
Framework, Zend_Config; , : -)
PHP .ini, , , , , .ini (And Zend_Config + Zend_Registry ).
Zend_Registry
, , Zend , . , , -
- , , , . , DB_HOST? , , , ?
DB_HOST
, . ? (, ..) , , , , , ? , ?
Zend_Config "" . , , .
Source: https://habr.com/ru/post/1724045/More articles:arrow key through stdin - bashCut the string a few pixels - c #Динамические отношения "один ко многим", использующие не-PK-поля: Заграничная таблица. Ссылки List.aspx используют неверный ключ для отношений "один ко многим" - c#C / C ++ Library for Basic Authentication HTTPS Client - c ++https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1724044/c-data-binding-a-single-custom-class-to-form-controls-checkbox&usg=ALkJrhiXo_Ruuwc5BxgpS50HC4kxtKh4aQTheme source code / plugin engine - directoryCan I send a text message from my computer to my cell phone? - smsJava: Why does this method have side effects? - javaHow to set up an external status page in TeamCity, like its standard one, which will not require me to log in? - continuous-integrationpattern matching over a range of values in scala - scalaAll Articles