Home > Q&A > body text
RT,php,想用curl同时发送文件和字符串,就是模拟一个表单中既有一堆字符串还有文件。
高洛峰2017-04-10 14:32:40
curl_setopt($curl_handle, CURLOPT_POST, 1); $args['file'] = '@/path/to/file'; $args['a'] = 'blablabla...'; //and so on curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $args);
更多的内容:https://wiki.php.net/rfc/curl-file-upload
迷茫2017-04-10 14:32:40
默认表单是没法同时POST字符串和文件的,可以考虑字符串用GET通过URL传递,同时POST文件。
POST
GET