From edb660cbcc60cbb3b1bdb814f288e9cc75de455e Mon Sep 17 00:00:00 2001 From: wangzemei Date: Mon, 17 Jun 2024 09:50:44 +0800 Subject: [PATCH] + [task#120474] add handling of array object and add comments. --- framework/helper.class.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/framework/helper.class.php b/framework/helper.class.php index e0d587e901..029ba92861 100644 --- a/framework/helper.class.php +++ b/framework/helper.class.php @@ -801,6 +801,15 @@ function debug($message = '', $file = 'undefined', $line = 0) $app->saveError(E_USER_WARNING, $message, $file, $line); } +/** + * 为数组使用字母排序。 + * Use alphabetical sorting for arrays. + * + * @param array $data + * @param string $fieldName + * @param string $suffix + * @return void + */ function addPrefixToField(&$data, $fieldName, $suffix = '. ') { $key = 0; @@ -817,6 +826,10 @@ function addPrefixToField(&$data, $fieldName, $suffix = '. ') { $item[$fieldName] = $prefix . $suffix . $item[$fieldName]; } + else + { + $item->{$fieldName} = $prefix . $suffix . $item->{$fieldName}; + } $key++; } }