企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
>一些复杂查询不建议写在控制器中,应该写在模型文件中,控制器中直接调用 ~~~ // 模型中创建查询 public function test() { // 使用mysql类库方法进行查询 return $this->select()->from($this->table)->where([ 'id' => 1 ])->order('id DESC')->limit(10)->all(); } // ==================================== // use model\Table; // 控制器中调用 public function test() { Table::instance()->test(); } ~~~ 具体复杂查询写法请查看 类库 > mysql 一节