From d470e43002e3809a4b78e9f29b7e472778629366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=83=E5=BD=A9=E6=9E=AB=E5=8F=B6?= <424235748@qq.com> Date: Tue, 6 Jun 2023 06:34:50 +0000 Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E5=8C=96=E8=8E=B7=E5=8F=96=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 七彩枫叶 <424235748@qq.com> --- app/functions.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/functions.php b/app/functions.php index 0daad760..08e27468 100644 --- a/app/functions.php +++ b/app/functions.php @@ -1382,8 +1382,17 @@ if (!function_exists('get_plugin_config')) { * @return array * @throws Exception|\Psr\SimpleCache\InvalidArgumentException */ - function get_plugin_config(string $name, bool $force = false): array - { + function get_plugin_config(string $name = '', bool $force = false): array + { + if($name==''){ + $request_controller = new \ReflectionClass(request()->controller); + preg_match_all('/!--(.*)\-->/s', $request_controller->getDocComment(), $plugin_arr); + if(empty($plugin_arr[1])) + { + halt('get_plugin_config()函数中 没有检测到 插件标识,请填写插件名称'); + } + $name=strtolower($plugin_arr[1][0]); + } $array = []; $cache = sha1('PLUGIN_' . $name); if (!$force || !get_env('APP_DEBUG')) { -- Gitee