From af275e1c6a50b246fade77f96f536a4d8cad003b Mon Sep 17 00:00:00 2001 From: wolfcode <37436228+wolf-leo@users.noreply.github.com> Date: Wed, 23 Oct 2024 10:27:06 +0800 Subject: [PATCH] fix(install): check for .env file existence before installation - Add a check for the presence of the .env file in the root directory - Update the index method to redirect to the admin page with a default value Signed-off-by: wolfcode <37436228+wolf-leo@users.noreply.github.com> --- app/index/controller/Index.php | 2 +- app/index/controller/Install.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/index/controller/Index.php b/app/index/controller/Index.php index fed9207..91ff931 100644 --- a/app/index/controller/Index.php +++ b/app/index/controller/Index.php @@ -14,6 +14,6 @@ class Index extends BaseController public function index(): Redirect { // 这是项目首页 系统默认跳转后台页面 - return redirect('/' . Env::get('EASYADMIN.ADMIN', false)); + return redirect('/' . Env::get('EASYADMIN.ADMIN', 'admin')); } } \ No newline at end of file diff --git a/app/index/controller/Install.php b/app/index/controller/Install.php index 8bdeafb..7b047f4 100644 --- a/app/index/controller/Install.php +++ b/app/index/controller/Install.php @@ -27,6 +27,9 @@ class Install extends BaseController }elseif (!extension_loaded("PDO")) { $errorInfo = '当前未开启PDO,无法进行安装'; } + if (!is_file(root_path() . '.env')) { + $errorInfo = '.env 文件不存在,请先配置 .env 文件'; + } if (!$request->isAjax()) { $currentHost = '://'; $result = compact('errorInfo', 'currentHost', 'isInstall');