我想將下面的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>
1 回答

ITMISS
TA貢獻1871條經驗 獲得超8個贊
看起來你想使用curl來上傳文件......
// initialise the curl request
$request = curl_init('http://example.com/');
// send a file
curl_setopt($request, CURLOPT_POST, true);
curl_setopt(
? ? $request,
? ? CURLOPT_POSTFIELDS,
? ? array(
? ? ? 'file' => '@' . realpath('example.txt')
? ? ));
// output the response
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($request);
// close the session
curl_close($request);
- 1 回答
- 0 關注
- 129 瀏覽
添加回答
舉報
0/150
提交
取消