Просмотр поста

.
Koenig
(\/)____o_O____(\/)

ramzes, простой парсер

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');
if (conf::get($access, $mode) === false)