gpt4 book ai didi

php - array_merge() : Argument #1 is not an array in laravel 5. 5

转载 作者:行者123 更新时间:2023-12-03 23:00:14 31 4
gpt4 key购买 nike

我遇到了一些问题,这是关于 laravel 中的 array_merge我的 Controller 代码方法:

    public function isConnectedMA()
{
$user_id = Auth::user()->id;
if(!empty($user_id)) {
$isConnectedM = DB::table('user_mlc_mailchimp')->where('user_id', $user_id)->get();
$isConnectedA = DB::table('user_mlc_aweber')->where('user_id', $user_id)->get();
}
$MergeArray = array_merge($isConnectedM,$isConnectedA);
$resultArray = ['status' => 1, 'message' => 'Template uploaded!', 'dataArray' => $MergeArray];
return Response::json($resultArray,200);

}

我遇到的错误是

array_merge(): Argument #1 is not an array

我不知道我哪里错了任何帮助将不胜感激!

最佳答案

使用toArray()集合转换为数组

$isConnectedM = DB::table('user_mlc_mailchimp')->where('user_id', $user_id)->get()->toArray();
$isConnectedA = DB::table('user_mlc_aweber')->where('user_id', $user_id)->get()->toArray();

关于php - array_merge() : Argument #1 is not an array in laravel 5. 5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50016058/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com