diff --git a/helper.php b/helper.php index e8af0a52..367e827f 100644 --- a/helper.php +++ b/helper.php @@ -23,6 +23,7 @@ use think\exception\HttpResponseException; use think\Lang; use think\Loader; use think\Log; +use think\model\Collection; use think\Request; use think\Response; use think\Session; @@ -565,3 +566,15 @@ if (!function_exists('load_relation')) { return $resultSet; } } + +if (!function_exists('collection')) { + /** + * 数组转换为数据集对象 + * @param array $resultSet 数据集数组 + * @return Collection + */ + function collection($resultSet) + { + return new Collection($resultSet); + } +}