From 103998d8ba4c7e65e3d83e16560a86c2f0d891fb Mon Sep 17 00:00:00 2001 From: augushong Date: Sat, 22 Mar 2025 17:11:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=A7=86=E5=9B=BE?= =?UTF-8?q?=E8=8C=83=E5=9B=B4=E7=B1=BB=E7=BB=84=E4=BB=B6=E5=A4=84=E7=90=86?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E6=97=B6=E6=B2=A1=E6=9C=89=E5=85=BC=E5=AE=B9?= =?UTF-8?q?null=E5=80=BC=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/base/helper.php | 14 ++++++++++++-- extend/think/template/taglib/Cx.php | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/extend/base/helper.php b/extend/base/helper.php index f6c44c1..d43419e 100644 --- a/extend/base/helper.php +++ b/extend/base/helper.php @@ -270,7 +270,7 @@ function event_handle_result($name, $key, $type = 'all', $params = []) : array } /** - * 字符拼接通用处理函数 + * 字符拼接通用处理函数. * * @param string $name * @param string $type @@ -286,7 +286,7 @@ function event_handle_string($name, $type) function event_view_content($name) { - return event_handle_string($name, 'view_content'); + return event_handle_string($name, 'view_content'); } function event_view_replace($content, $name) @@ -418,3 +418,13 @@ if (!function_exists('get_site_version_key')) { return sysconfig('site', 'site_version') . '-' . Version::VERSION . '-' . Version::PRODUCT_VERSION . '-' . Version::LAYUI_VERSION; } } +if (!function_exists('format_null_value')) { + function format_null_value($value) + { + if (is_null($value)) { + return ''; + } + + return $value; + } +} diff --git a/extend/think/template/taglib/Cx.php b/extend/think/template/taglib/Cx.php index cbbfabe..5faedcd 100644 --- a/extend/think/template/taglib/Cx.php +++ b/extend/think/template/taglib/Cx.php @@ -385,7 +385,7 @@ class Cx extends Taglib if ('$' == $flag || ':' == $flag) { $value = $this->autoBuildVar($value); - $str = 'is_array(' . $value . ')?' . $value . ':explode(\',\',' . $value . ')'; + $str = 'is_array(' . $value . ')?' . $value . ':explode(\',\',format_null_value(' . $value . '))'; } else { $value = '"' . $value . '"'; $str = 'explode(\',\',' . $value . ')';