{% else-1 %}

                        
class conf {



private static $file;

private static $data;



public function __construct($file) {

self::$file = $file;

}



public static function get($section, $name=null) {

if (self::$data === null) {

self::$data = parse_ini_file(self::$file, true);

if (self::$data === false) {

throw new Exception('Файл отсутствует');

}

}



if (array_key_exists($section, self::$data)) {

if ($name && array_key_exists($name, self::$data[$section])) {

return self::$data[$section][$name];

} else {

return self::$data[$section];

}

} else {

return false;

}

}



}
Подпись:

new conf('ini/access.ini');

echo conf::get($sections, $mode);
-7 10 0
0

Нет фото
• 15 фев 2014, 18:45


На сайте дыра 208488980