[PHP]post传递数据时的报错Array to string conversion

当使用curl传递post数据时 , 数据的字段如果是个数组,就会报错Array to string conversion

在调用curl_setopt_array($curl, $options);

调用curl_setopt($ch, CURLOPT_POSTFIELDS, $data)

这两处地方都可能会报错 , 解决办法是把数据数组处理一下

http_build_query($data)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章