mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 23:52:49 +08:00
增加collection助手函数 快速转换数组为数据集对象
This commit is contained in:
13
helper.php
13
helper.php
@@ -23,6 +23,7 @@ use think\exception\HttpResponseException;
|
|||||||
use think\Lang;
|
use think\Lang;
|
||||||
use think\Loader;
|
use think\Loader;
|
||||||
use think\Log;
|
use think\Log;
|
||||||
|
use think\model\Collection;
|
||||||
use think\Request;
|
use think\Request;
|
||||||
use think\Response;
|
use think\Response;
|
||||||
use think\Session;
|
use think\Session;
|
||||||
@@ -565,3 +566,15 @@ if (!function_exists('load_relation')) {
|
|||||||
return $resultSet;
|
return $resultSet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!function_exists('collection')) {
|
||||||
|
/**
|
||||||
|
* 数组转换为数据集对象
|
||||||
|
* @param array $resultSet 数据集数组
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
function collection($resultSet)
|
||||||
|
{
|
||||||
|
return new Collection($resultSet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user