我在laravel 5.5中有这个错误:
数组转换为字符串(SQL:插入
channel_txt_posts
(channel_id
,subcategoty_id
,message_id
,media_id
,media_accesshash
,media_kind
,body
,view
)值(370,1,578, 5800649510354004639,6584445945021826373,1,“@ funn_gram”,252))
虽然它似乎是真的,因为当我在phpmyadmin中使用sql查询时,它可以正常工作。
insert into `channel_txt_posts` (`channel_id`, `subcategoty_id`, `message_id`, `media_id`, `media_accesshash`, `media_kind`, `body`, `view`) values (370, 1, 578, 5800649510354004639, 6584445945021826373, 1, "@funn_gram", 252)
我使用了laravel查询构建器和orm,两者都有相同的错误。
Channel_txt_posts::create([
'channel_id' => $channel_id,
'subcategoty_id' => 1,
'message_id' => $ids,
'body'=> "df",
'view' => $viewcount,
]);
$data = new Channel_txt_posts;
$data->channel_id = $channel_id;
$data->subcategoty_id = 1;
$data->message_id = $ids;
$data->body = json_encode($myName);
$data->view = $viewcount;
$data->save();
我该如何解决这个问题?