Re: Config files
| From: | Ray Hunter | Date: | Thu, 14 Aug 2003 01:29:33 +0000 |
| Subject: | Re: Config files | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-159510@lists.php.net to get a copy of this message | ||
I tend do do something similar here:
I usually set up my arrays and then access them later using the GLOBALS
superglobal array. For some projects I tend to use multidimensional
arrays because I can do something like.
$config['db']['name'] = 'something';
$config['db']['user'] = 'someone';
$config['db']['pass'] = 'password';
...
This can sometimes be an over kill, however that could work for you.
--
BigDog
On Wed, 2003-08-13 at 08:19, CPT John W. Holmes wrote:
> From: "Hardik Doshi" <php_hardik@yahoo.com>
> > I have following options for working with the
> > configuration files with the relatively large web
> > application.
> >
> > 1. Configuration variables using the DEFINE.
> >
> > 2. Array - Each configuration variable as an array
> > element.
> >
> > 3. PHP.INI like config files.
>
> A combination of #3 and #2. Store the data in a php.ini-style config file
> and use parse_ini_file() to read it into an array.
>
> You could even merge the array into the $_SERVER (or any other superglobal)
> array so that your config vars are available in functions without having to
> make anything global.
>
> ---John Holmes...
>