/** * @return WF_Application_View_Abstract */ public static function GetView() { if (self::$_View) { return self::$_View; } if (WF_Application_Manager::$Config->app->view) { $view = WF_Application_Manager::Component(WF_Application_Manager::$Config->app->view); } else { $view = new WF_Application_View_Standard(); } return self::$_View = $view; }
<?php define('APP_PATH', dirname(dirname(__FILE__))); define('PUBLIC_PATH', APP_PATH . '/public'); require APP_PATH . '/lib/WF/Application/Manager.php'; WF_Application_Manager::run(APP_PATH . '/config.php', 'product');
/** * 初始化配置 * 根据当前的环境 去初始化出系统所需要的配置 */ private static function _InitConfig($configFile, $env) { if (file_exists($configFile)) { //specify env config require $configFile; if ($env === 'product') { $develop = null; unset($develop); } else { $product = null; unset($product); } self::$Config = ${$env}; //check config validation. //create error_file if (isset(self::$Config->app->error_log) && !file_exists(self::$Config->app->error_log)) { $fp = fopen(self::$Config->app->error_log, "w+"); //打开文件指针,创建文件 if (!is_writable(self::$Config->app->error_log)) { throw new Exception('sorry the file' . self::$Config->app->error_log . ' is not writable'); } fclose($fp); //关闭指针 } } else { throw new Exception("WF didn't find {$configFile} config file"); } }