tp5将查询数据返回为对象转为数组

use thinkModel;
collection()->toArray();
$result = collection(model("Menu")->order("listorder asc,id asc")->select())->toArray();


或是在模型里写
namespace appadminmodel;

class Menu extends 	hinkModel
{
protected $resultSetType = 'collection';
}

控制器
$result = model("Menu")->order("listorder asc,id asc")->select()->toArray();

  

参考tp5官方网站论坛:http://www.thinkphp.cn/topic/47321.html

let the world have no hard-to-write code ^-^
原文地址:https://www.cnblogs.com/ovim/p/11387341.html