/** * 创建ElexConfig的实例 * @param $config_file * @param $options * @return ElexConfig */ public static function getInstance($config_file, $options = null) { if (!self::$instance instanceof self) { self::$use_apc_cache = function_exists('apc_fetch'); // 验证配置文件路径的正确性 self::checkConfigPath($config_file); // 先尝试从缓存中反序列化 self::$instance = self::getConfigFromCache($config_file); if (empty(self::$instance)) { // 创建一个新的ElexConfig对象 self::$instance = new self($config_file, $options); // 将对象序列化后写入缓存 self::writeConfigToCache($config_file, self::$instance); } } return self::$instance; }