首页 > ThinkPHP3.2.2 where in 错误的查询条件:[TypeId=>Array]

ThinkPHP3.2.2 where in 错误的查询条件:[TypeId=>Array]

PHP代码

class BaseNewsModel extends BaseModel
{
    protected $tableName = 'tb_base_news';

    public function getList($TypeId = 0, $Num = 10)
    {
        $map = array(
            'TypeId' => array('in', $TypeId)
        );
        $arr = M('v_admin_newslist')->where($map)->limit($Num)->select();

        return $arr;
    }
}

报错提示

错误的查询条件:[TypeId=>Array]

原先TP3.1.X

原先TP 3.1.x 和现在TP 3.2.x的官网文档都是说可以这样使用的:
截图


用官网文档的方式,是可以进行查询的啊。我觉得你应该先验证参数$TypeId为合格的数组或字符串。

【热门文章】
【热门文章】