我使用curl 和php 上传文件。我需要帮助来设置自定义请求标头键,例如
X-Filename blahblah.zip
X-Filesize 2677
X-Filetype application/zip
您必须使用curl_setopt() http://www.php.net/manual/en/function.curl-setopt.php函数及其CURLOPT_HTTPHEADER
选项(引用):
要设置的 HTTP 标头字段数组,格式为array('Content-type: text/plain', 'Content-length: 100')
基本上,就你的情况而言,你会有这样的事情:
$headers = array(
'X-Filename: blahblah.zip',
'X-Filesize: 2677',
'X-Filetype: application/zip',
);
curl_setopt($your_resource, CURLOPT_HTTPHEADER, $headers);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)