«

thinkphp5 子查询 闭包查询

Genius 发布于 阅读:54


<?php
namespace app\before\controller;
use think\Controller;
use think\Db;
//use app\before\model\Article;

class Before extends Controller
{

public function Index()
{
    $sj = Db::name('article')->where('article_id','in',function ($query){
        $query->name('brand')->field('brand_id')->where('brand_name','测试1');
    })->select();
    return json($sj);

}

}

?>