/** * 运行InitPHP开发框架 - 框架运行核心函 * 1. 在index.php中实例化InitPHP启动类 InitPHP::Init(); * 2. 初始化网站路由,运行框架 * 3. 全局使用方法:InitPHP::Init(); * @return object */ public static function init($appPath, $config) { $config = self::import(DS . 'config' . DS . $config . ".php"); self::addConfig($config); self::setAppPath($appPath); if ($session_config = self::getConfig('SESSION')) { if ($handle = $session_config['SESSION_HANDLE']) { ini_set('session.save_handler', $handle['NAME']); ini_set('session.save_path', $handle['SAVE_PATH']); } session_start(); } if (self::getConfig('ERROR_HANDLE')) { set_error_handler(array('self', 'handleError'), error_reporting()); } spl_autoload_register(array('self', 'loader')); self::getInstance(); try { $dispatcher = InitPHP::loadclass('DispatcherInit'); $dispatcher->dispatcher(); self::$_app = InitPHP::loadclass('RunInit'); self::$_app->run(); } catch (ExceptionInit $e) { ExceptionInit::errorTpl($e); } }