From d68115c946c68c029bafd267aefe369a9135e513 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 16 Jan 2017 23:03:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0collection=E5=8A=A9=E6=89=8B?= =?UTF-8?q?=E5=87=BD=E6=95=B0=20=E5=BF=AB=E9=80=9F=E8=BD=AC=E6=8D=A2?= =?UTF-8?q?=E6=95=B0=E7=BB=84=E4=B8=BA=E6=95=B0=E6=8D=AE=E9=9B=86=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helper.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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); + } +}