且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

传递给Illuminate \ Database \ Grammar :: parameterize()的参数1必须为数组类型,给定字符串

更新时间:2021-08-04 21:24:56

在一个地方使用$file_ids,在其他地方使用$files_ids,请确保使用相同的变量.

In one place you are using $file_ids and in others $files_ids so make sure you are using same variable.

此外,您确定在$file_ids数组中有有效值吗?

In addition are you sure you have valid values in $file_ids array?

看评论的问题是:

$downloadLink->file_ids = $file_ids;

inside makeDownloadLink方法中.

inside makeDownloadLink method.

您正在执行以下操作:

if (count($file_ids) > 1) { 
   $downloadLink->file_ids = implode(',', $file_ids); 
} 
$downloadLink->file_ids = $file_ids;

,当$file_ids为数组时,这将失败.您应该像这样在此处添加else:

and this will fail when $file_ids is array. You should probably add else here like so:

if (count($file_ids) > 1) { 
   $downloadLink->file_ids = implode(',', $file_ids); 
} 
else {
   $downloadLink->file_ids = $file_ids;
}