小编Xav*_*lar的帖子

使用Guzzle删除带参数的请求

我必须在CodeIgnitor平台中使用参数执行DELETE请求.首先,我尝试使用cURL,但我切换到了Guzzle.

控制台中的请求示例如下:

curl -X DELETE -d '{"username":"test"}' http://example.net/resource/id
Run Code Online (Sandbox Code Playgroud)

但是在Guzzle的文档中,他们像GET一样使用参数DELETE http://example.net/resource/id?username=test,我不想这样做.

我尝试过:

$client = new GuzzleHttp\Client();
$client->request('DELETE', $url, $data);
Run Code Online (Sandbox Code Playgroud)

但请求只是调用DELETE http://example.com/resource/id没有任何参数.

php curl codeigniter http-delete guzzle

3
推荐指数
1
解决办法
6713
查看次数

标签 统计

codeigniter ×1

curl ×1

guzzle ×1

http-delete ×1

php ×1