/** * 编译核心文件 * @access private */ private static function compile() { $boot = TEMP_PATH . TEMP_FILE; if (DEBUG) { is_file($boot) and unlink($boot); return; } $compile = ''; //常量编译 $_define = get_defined_constants(true); foreach ($_define['user'] as $n => $d) { if ($d == '\\') { $d = "'\\\\'"; } else { $d = is_int($d) ? intval($d) : "'{$d}'"; } $compile .= "defined('{$n}') OR define('{$n}',{$d});"; } $files = array(HDPHP_CORE_PATH . 'HDPHP.class.php', HDPHP_CORE_PATH . 'HdphpException.class.php', HDPHP_CORE_PATH . 'App.class.php', HDPHP_CORE_PATH . 'Route.class.php', HDPHP_CORE_PATH . 'Log.class.php', HDPHP_CORE_PATH . 'Event.class.php', HDPHP_FUNCTION_PATH . 'Functions.php', HDPHP_FUNCTION_PATH . 'Common.php', HDPHP_DRIVER_PATH . 'View/View.class.php', HDPHP_DRIVER_PATH . 'View/Hd/Compile.class.php'); foreach ($files as $f) { $con = compress(trim(file_get_contents($f))); $compile .= substr($con, -2) == '?>' ? trim(substr($con, 5, -2)) : trim(substr($con, 5)); } $compile .= 'C(' . var_export(C(), true) . ');'; $compile .= 'L(' . var_export(L(), true) . ');'; $compile .= 'alias_import(' . var_export(alias_import(), true) . ');'; self::$_compile = $compile; }