/** * 启动并缓存app实例 */ function app($settings_file = '') { static $app = null; if (is_null($app) && $settings_file) { $importer = \Cute\Importer::getInstance(); $importer->addNamespace('Cute', SRC_ROOT); $storage = \Cute\Base\Storage::newInstance($settings_file); $class = constant('APP_CLASS'); $app = new $class($storage); $app->install($importer, array('import' => 'addNamespace')); $app->initialize(); } return $app; }
function app($sD = '') { static $j = null; if (is_null($j) && $sD) { $XD = \Cute\Importer::getInstance(); $XD->addNamespace('Cute', SRC_ROOT); $tB = \Cute\Base\Storage::newInstance($sD); $H = constant('APP_CLASS'); $j = new $H($tB); $j->install($XD, array('import' => 'addNamespace')); $j->initialize(); } return $j; }