pref: 优化get_env函数

This commit is contained in:
Ying
2023-04-26 15:19:26 +08:00
parent 3a29410fdd
commit 8b1e63abcc

View File

@@ -137,8 +137,8 @@ if (!function_exists('get_env')) {
{
$dir = str_replace('\\', '/', realpath(__DIR__ . '/../'));
$env_path = $dir . '/.env';
$env_info = [];
if (is_file($env_path)) {
static $env_info = [];
if (is_file($env_path) && !$env_info) {
$env_info = parse_ini_file($env_path, true);
}
return $env_info[$var] ?? '';