public static function Prepare($config) { Define('DS', DIRECTORY_SEPARATOR); Define('FRAMEWORK_DIR', dirname(dirname(__FILE__)) . "/cherryphp"); Define('APP_DIR', dirname(dirname(__FILE__))); spl_autoload_register(array('Cherry', 'LoadClass')); Init::$Router = (require APP_DIR . DS . 'router.php'); if (!empty($config)) { Init::$Config = (require $config . "config.php"); } else { Init::$Config = (require APP_DIR . DS . 'config.php'); } foreach (Init::$Config['define'] as $k => $v) { Define($k, Init::$Config['define'][$k]); } #spl_autoload_register(array('Cherry','appClass')); return new self(); }