configuration files - my_config.ini vs my_config.php -
We use an .i file at work to set the variable before calling the rest of the framework (I It seems that this
function getConfigVars () {// read my_config.ini file .... // call framework} and always amazed me To do that, there was no benefit.
It seems that you have to write an access rule to prevent people from viewing it from the web and parsing it to php and understanding it
P> Then, why use my_config.ini instead of my_config.php? It is not like someone should touch it after setting it and it only calls the variable and Your IDE seems more convenient to be able to complete auto text wherever you are using ini variable / it is parsing it for errors.
Contains a configuration parser that extends the files Does that have been written in that Inai format (), it looks like you're using it.
The config file should not be located in your document root, and if it is not in your document root, then the rules of writing again are not required because anyone can access it in any way .
The configuration data in the INI format is specialized to provide both capabilities of inheritance between the hierarchy of data keys and the configuration data sections. Configuration data hierarchy is separated by separating keys with dot or duration character (.). Following a section section name with a colon character (:) and the name of the section by which the data can be obtained from the succession, it may extend or succession from another section.
From the page
The Zend Framework allows you to have several configuration parameters, one for staging, one for development and one for the output. It also allows easy setting for settings, database settings, and for development and having two very different settings. Where different paths are set in the INI file, it simplifies the code from development to production, so that knowing everything that the development will stop immediately.
Of course, this would be possible with PHP scripts, but for this it will require more parsing, along with different configuration variables, if / again checks, using parse_ini_file () Do all this for everyone.
Other responses have already been told that non-programmers change the variable or something on the website that is set as the configuration variable (for example, the site title used in the site layout goes). . INI files understand and even someone who has never been programmed for easy to read
Example from a website I am currently working on:
[output] phpSettings.display_startup_errors = 0 = 0 phpSettings.display_errors includePaths.library = APPLICATION_PATH "/../library" bootstrap.path = APPLICATION_PATH "/Bootstrap.php" bootstrap.class = "bootstrap" resources.frontController. ControllerDirectory = APPLICATION_PATH "/ controller" resources. Layout.layoutPath = APPLICATION_PATH "/ layout / scripts" resources.db.adapter = "PDO_SQLITE" resources.db.params.dbname = APPLICATION_PATH "/../data/db/users.db" resources.view [] = [scaffolding] : Production] [test: production] phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 resources.db.params.dbname = APPLICATION_PATH "/../data/db/users-testing.db" [development: production] phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 resources.db.params.dbname = APPLICATION_PATH "/../data/db/users-dev.db It's very easy to have different environments, in which the code is run For many data sets, the state has become.
Comments
Post a Comment