能不能通過curl模擬出下面html的形式來上傳圖片
<input type="file" name="imgs[]"/>
<input type="file" name="imgs[]"/>
<input type="file" name="imgs[]"/>
$file_obj = curl_file_create(realpath($file), 'image/png');
$data['imgs'][] = $file_obj;
也就是說是這種。但是這個會報錯,Array to string conversion
我用http_build_query()來處理。但是這樣處理之后$_FILES就接收不到值了
請問有沒有什么辦法,可以解決
1 回答

慕斯709654
TA貢獻1840條經驗 獲得超5個贊
既然HTML input
的name
是imgs[]
,那curl也用這個就行了($data['imgs[]']=$file_obj
),而不是搞個數組。
- 1 回答
- 0 關注
- 463 瀏覽
添加回答
舉報
0/150
提交
取消