From a7266f78a0946c8717ef990c64bdce7adbd7d0a7 Mon Sep 17 00:00:00 2001 From: Edward Yang Date: Thu, 8 Sep 2022 11:33:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20.htaccess=20https://guangd?= =?UTF-8?q?agit.com/beike/beikeshop/issues/226?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- public/{.htaccess => htaccess.txt} | 0 public/index.php | 15 ++++++++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) rename public/{.htaccess => htaccess.txt} (100%) diff --git a/.gitignore b/.gitignore index 5dc0588d..ca082b47 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /node_modules +/public/.htaccess /public/hot /public/storage /public/upload/avatar @@ -21,4 +22,4 @@ package-lock.json beike/node_modules /public/build/beike/* /public/install/css/* -dist \ No newline at end of file +dist diff --git a/public/.htaccess b/public/htaccess.txt similarity index 100% rename from public/.htaccess rename to public/htaccess.txt diff --git a/public/index.php b/public/index.php index 536f6d44..ba821908 100644 --- a/public/index.php +++ b/public/index.php @@ -3,6 +3,17 @@ use Illuminate\Contracts\Http\Kernel; use Illuminate\Http\Request; +$basePath = getcwd() . '/'; +$htaPath = $basePath . '.htaccess'; +$htaExamplePath = $basePath . 'htaccess.txt'; +if (!file_exists($htaPath)) { + if (file_exists($htaExamplePath)) { + copy($htaExamplePath, $htaPath); + } else { + touch($htaPath); + } +} + if (!file_exists(__DIR__ . '/../storage/installed') && (!isset($_SERVER['REDIRECT_URL']) || substr($_SERVER['REDIRECT_URL'], 0, 10) != '/installer') && (stripos($_SERVER['REQUEST_URI'], '_debugbar') !== 1)) { @@ -11,7 +22,9 @@ if (!file_exists(__DIR__ . '/../storage/installed') } if (version_compare(PHP_VERSION, '8.0.2', '<') == true) { - exit('PHP8.0.2+ Required'); + echo 'Your current version of PHP does not meet the requirements. Upgrade to at least version 8.0.2
'; + echo '您当前PHP版本不满足要求,至少升级至8.0.2版本'; + exit; } define('LARAVEL_START', microtime(true));