diff --git a/app/index/controller/Index.php b/app/index/controller/Index.php index d988ed5f..06756a49 100755 --- a/app/index/controller/Index.php +++ b/app/index/controller/Index.php @@ -58,12 +58,13 @@ class Index extends AdminBase $list['group'] = $admin->searchOne(session('user_id'))->groupnames; - $list['server'] = array_replace([ - // PHP's built-in server does not populate these Apache-specific - // entries; provide portable values for the dashboard. - 'SERVER_ADDR' => request()->host(), - 'SERVER_SOFTWARE' => PHP_SAPI, - ], request()->server()); + $server = request()->server(); + $list['server'] = [ + // Some web servers expose these keys with null values. Keep the + // template input non-null so it can safely access both entries. + 'SERVER_ADDR' => $server['SERVER_ADDR'] ?? request()->host(), + 'SERVER_SOFTWARE' => $server['SERVER_SOFTWARE'] ?? PHP_SAPI, + ]; // 获取系统版本号 $list->version = config('shangma.version'); // 获取php版本号