title: ThinkPhp埋坑指南
date: 2018-10-05 17:14:01
tags: ThinkPHP
查询多列数据,返回一维数组
$resSort = new ResSort();
$resSortList = $resSort->where(1)->select();
$sort = [];
foreach ($resSortList as $resSortItem) {
array_push($sort, $resSortItem['sort']);
}
if ($sort) {
return GlobalVariable::promptData(['sort' => $sort]);
}
需要使用foreach来循环建立数组,并在返回时指明数组名。