Laravel。将数组插入原始sql查询

时间:2017-02-14 20:18:16

标签: php mysql laravel

我有一个数组$blshopids = [5,8];,我想插入原始SQL语句:

$blshopids = [5,8];
$blshops = implode(",", $blshopids);
$product = 1;

...
where p1.product_id = :product
and p1.shop_id not in (:blshops)
..., ['product' => $product, 'blshops' = $blshops];

正如您所猜测的,$ blshops成为字符串'5,8'而我得p1.shop_id not in ('5,8')而不是p1.shop_id not in (5,8)。知道怎么解决吗?

0 个答案:

没有答案