From ea8ea715b993b17ebbb1cafb40574ef999bf0cba Mon Sep 17 00:00:00 2001 From: Karson Date: Fri, 27 Jun 2025 17:11:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96CRUD=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=80=BC=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/command/Crud.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/application/admin/command/Crud.php b/application/admin/command/Crud.php index 5941e0c7..e03f7244 100755 --- a/application/admin/command/Crud.php +++ b/application/admin/command/Crud.php @@ -763,6 +763,13 @@ EOD; $cssClassArr = ['form-control']; $fieldName = "row[{$field}]"; $defaultValue = $v['COLUMN_DEFAULT']; + + $defaultValue = $defaultValue === 'NULL' ? '' : (string)$defaultValue; + if (preg_match("/^'.*'$/", $defaultValue) && strlen($defaultValue) >= 2) { + // 去掉首尾单引号 + $defaultValue = substr($defaultValue, 1, -1); + } + $editValue = "{\$row.{$field}|htmlentities}"; // 如果默认值非null,则是一个必选项 if ($v['IS_NULLABLE'] == 'NO') {