【发布时间】:2018-07-03 09:34:48
【问题描述】:
我正在尝试在变量 $sections 中收集属于发生在他们身上的部分的所有记录。但只有第 1 节的人接我。有什么建议吗?
$sections = '1,2,3';
$data = News::where('active', '1')
->whereIn('section_id', [$sections])
->get();
如果我将查询中的 $sections 替换为值,这是可行的,但如果我使用变量 $sections,它就不起作用了。
谢谢。
【问题讨论】:
标签: php sql database laravel where-in