/** * 初始化App配置 * @param string $app_name * @param array $runtime_config * @return $this * @throws \Cross\Exception\FrontException */ private static function initConfig($app_name, $runtime_config) { $config = Config::load(APP_PATH_DIR . $app_name . DIRECTORY_SEPARATOR . 'init.php')->parse($runtime_config); $request = Request::getInstance(); $host = $request->getHostInfo(); $index_name = $request->getIndexName(); $request_url = $request->getBaseUrl(); $base_script_path = $request->getScriptFilePath(); //设置app名称和路径 $config->set('app', array('name' => $app_name, 'path' => APP_PATH_DIR . $app_name . DIRECTORY_SEPARATOR)); //静态文件url和绝对路径 $config->set('static', array('url' => $host . $request_url . '/static/', 'path' => $base_script_path . DIRECTORY_SEPARATOR . 'static' . DIRECTORY_SEPARATOR)); //url相关设置 $config->set('url', array('index' => $index_name, 'host' => $host, 'request' => $request_url, 'full_request' => $host . $request_url)); return $config; }