From ab89d2d50634ed3cf4b773962db7a587b67d7ea8 Mon Sep 17 00:00:00 2001 From: Karson Date: Fri, 26 Mar 2021 16:46:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96API=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=8F=82=E6=95=B0=E6=A0=BC=E5=BC=8F=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/command/Api.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/application/admin/command/Api.php b/application/admin/command/Api.php index 2c719842..b7ed2b34 100644 --- a/application/admin/command/Api.php +++ b/application/admin/command/Api.php @@ -37,6 +37,10 @@ class Api extends Command $force = $input->getOption('force'); $url = $input->getOption('url'); $language = $input->getOption('language'); + $template = $input->getOption('template'); + if (!preg_match("/^([a-z0-9]+)\.html\$/i", $template)) { + throw new Exception('template file not correct'); + } $language = $language ? $language : 'zh-cn'; $langFile = $apiDir . 'lang' . DS . $language . '.php'; if (!is_file($langFile)) { @@ -51,7 +55,7 @@ class Api extends Command } // 模板文件 $template_dir = $apiDir . 'template' . DS; - $template_file = $template_dir . $input->getOption('template'); + $template_file = $template_dir . $template; if (!is_file($template_file)) { throw new Exception('template file not found'); }