如何将 Curl 命令转换为 php 的 -i -t 选项

我想将下面的curl命令转换为php,我尝试从https://incarnate.github.io/curl-to-php/进行转换,但它没有正确转换。我如何<myobject>在 php 中设置curl?我没有得到。有人能帮我吗?

curl -i -T <myobject> -X PUT -H "X-Auth-Token: <token>" <storage url>


MMTTMM
浏览 114回答 1
1回答

ITMISS

看起来你想使用curl来上传文件......// initialise the curl request$request = curl_init('http://example.com/');// send a filecurl_setopt($request, CURLOPT_POST, true);curl_setopt(    $request,    CURLOPT_POSTFIELDS,    array(      'file' => '@' . realpath('example.txt')    ));// output the responsecurl_setopt($request, CURLOPT_RETURNTRANSFER, true);echo curl_exec($request);// close the sessioncurl_close($request);
打开App,查看更多内容
随时随地看视频慕课网APP