Пример #1
0
 private static function init()
 {
     if (self::$fp === NULL) {
         self::$ip = new self();
         self::$fp = fopen(__DIR__ . '/17monipdb.dat', 'rb');
         if (self::$fp === FALSE) {
             throw new Exception('Invalid 17monipdb.dat file!');
         }
         self::$offset = unpack('Nlen', fread(self::$fp, 4));
         if (self::$offset['len'] < 4) {
             throw new Exception('Invalid 17monipdb.dat file!');
         }
         self::$index = fread(self::$fp, self::$offset['len'] - 4);
     }
 }