|
Posted by Sonnich on 06/19/06 16:56
Hi all!
I have an app which reads from certain servers, but I'd like to have
them in am ini-file.
I made this up, but I need those vars to be visible in functions
too.... how do I do that?
BR
Sonnich
// default ini values
$dir1="\\\\server1\\finance";
$dir2="\\\\server2\\design\\";
// read in settings
$ini=fopen("config.ini", "r");
while(!feof($ini))
{
$line=fgets($ini, 100);
if(stristr($line, 'dir1') == TRUE)
{
$dir1=strstr($line, '=');
$dir1=trim(substr($dir1, 1, 1000));
}
else if(stristr($line, 'dir2') == TRUE)
{
$dir2=strstr($line, '=');
$dir2=trim(substr($dir2, 1, 1000));
}
}
fclose($ini);
Navigation:
[Reply to this message]
|