From 4e02b8c7722313e6293bc2ebc875440a5fa86216 Mon Sep 17 00:00:00 2001 From: augushong Date: Mon, 28 Oct 2019 09:37:10 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A6=81=E6=AD=A2=E4=B8=8A=E4=BC=A0php?= =?UTF-8?q?=E6=88=96=E8=80=85=E5=9B=BE=E7=89=87=E6=B7=B7=E5=90=88php?= =?UTF-8?q?=E6=9C=A8=E9=A9=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/Files.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/api/controller/Files.php b/app/api/controller/Files.php index 1747bd6..1c32c1f 100644 --- a/app/api/controller/Files.php +++ b/app/api/controller/Files.php @@ -35,6 +35,20 @@ class Files extends BaseController $file = request()->file('file'); + $file_extension = $file->extension(); + + if($file_extension == 'php'){ + return json_message('上传文件异常'); + } + + $file_path = $file->getRealPath(); + + $file_content = file_get_contents($file_path); + + if(strpos($file_content,'