Php 如何通过CURL发送数组请求
我需要像这样的文件上传表格Php 如何通过CURL发送数组请求,php,curl,Php,Curl,我需要像这样的文件上传表格 <form method="post" enctype="multipart/form-data"> <input type="file" name="f[]"> <input type="file" name="f[]"> <input type="file" name="f[]"> <input type="submit"> </form> 我知道这件事,我把这件事搞混了 我试图通过数组:
<form method="post" enctype="multipart/form-data">
<input type="file" name="f[]">
<input type="file" name="f[]">
<input type="file" name="f[]">
<input type="submit">
</form>
我知道这件事,我把这件事搞混了
我试图通过数组:
$ch = curl_init();
$data = array('name' => 'Foo', 'f[]' => array('@/fil1.png', '@/fil2.png'));
curl_setopt($ch, CURLOPT_URL, 'http://localhost/upload.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_exec($ch);
它不起作用。可能是重复的。您试过这个吗$数据=数组('f'=>数组('@/fil1.png','@/fil2.png','@/fil3.png');不适合我。我正试图将它与tmhOAuth结合使用,将多张图片上传到twitter。
$ch = curl_init();
$data = array('name' => 'Foo', 'f[]' => array('@/fil1.png', '@/fil2.png'));
curl_setopt($ch, CURLOPT_URL, 'http://localhost/upload.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_exec($ch);