use think\Model; collection()->toArray(); $result = collection(model("Menu")->order("listorder asc,id asc")->select())->toArray(); 或是在模型里寫 namespace app\admin\model; class Menu extends \think\Model { protected $resultSetType = 'collection'; } 控制器 $result = model("Menu")->order("listorder asc,id asc")->select()->toArray();
參考tp5官方網站論壇:http://www.thinkphp.cn/topic/47321.html