ThinkPHP5 闭包查询 Query where 查询条件为变量时候use

2019-09-13 18:413110
->where(function (Query $query) use ($currentCid) {
                if (!empty($currentCid)) {
                    $query->where('id', 'neq', $currentCid);
                }
            })
$currentCid为变量,注意代码中的
use ($currentCid)

上一篇: m_substr字符串截取

下一篇: ThinkPHP5.1的Log::write()