Jump to content

config files


ToonMariner

Recommended Posts

Hi all,

 

I have been looking at some code for a chaps site (ober has too) and had a question.

 

The particular site has a config file and uses parse_ini_file to grab all the variable/value pairs then loops through and creates a constant for them all.

 

I personally have config files that are simply a set of define statements to set constants and their values.  Not with standing the fact that and extra level of processing is involved what is the benefit of the parse_ini_file and subsequent define method?

Link to comment
https://forums.phpfreaks.com/topic/56677-config-files/
Share on other sites

err if you read the last line it says

 

what is the benefit of the parse_ini_file and subsequent define method?

 

I suppose I should add

 

'over just defining constants...'

 

MY config files look liek this

<?php

define('DBHOST' , 'localhost'); // db server.

define('DBNAME' , 'xyz'); // database name.

...

define('INCLUDEDIR', '/includes/');

?>

 

the method I have seen in this other code has a config.ini file very similar to php.ini in structure

 

the code uses parse_ini_file();

 

then takes all the parameters form that and loops through each and defines a constant with the parameter name and assigins its value.

 

Just wanted to know why you would use a .ini file and then use define on all parameters when you could simply use a file full of define staements in the first place.

Link to comment
https://forums.phpfreaks.com/topic/56677-config-files/#findComment-280050
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.