+ [task#120474] add handling of array object and add comments.

This commit is contained in:
wangzemei
2024-06-17 10:05:51 +08:00
committed by 刘刚
parent cd2138b57b
commit edb660cbcc
+13
View File
@@ -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++;
}
}