diff --git a/config/config.php b/config/config.php index d90da9af94..12950df9f0 100644 --- a/config/config.php +++ b/config/config.php @@ -202,6 +202,7 @@ if(file_exists($cacheConfig)) include $cacheConfig; /* 读取环境变量的配置。 Read the env config. */ if($config->inContainer || $config->inQuickon) { + $webRoot = getenv('ZT_WEB_ROOT') ? trim($webRoot, '/') : ''; $config->installed = (bool)getenv('ZT_INSTALLED'); $config->debug = (int)getenv('ZT_DEBUG'); $config->requestType = getenv('ZT_REQUEST_TYPE'); @@ -214,7 +215,7 @@ if($config->inContainer || $config->inQuickon) $config->db->encoding = getenv('ZT_DB_ENCODING'); $config->db->password = getenv('ZT_DB_PASSWORD'); $config->db->prefix = getenv('ZT_DB_PREFIX'); - $config->webRoot = getenv('ZT_WEB_ROOT'); + $config->webRoot = $webRoot ? "/{$webRoot}/" : '/'; $config->default->lang = getenv('ZT_DEFAULT_LANG'); } diff --git a/framework/base/helper.class.php b/framework/base/helper.class.php index 9965197023..e89ef2564b 100644 --- a/framework/base/helper.class.php +++ b/framework/base/helper.class.php @@ -1161,7 +1161,7 @@ function isLocalIP() */ function getWebRoot($full = false) { - if(getenv('APP_WEB_ROOT')) return '/' . trim(getenv('APP_WEB_ROOT'), '/') . '/'; + if(getenv('ZT_WEB_ROOT')) return '/' . trim(getenv('ZT_WEB_ROOT'), '/') . '/'; $path = $_SERVER['SCRIPT_NAME'];