HTTP PUT 方法令人困惑
HTTP PUT method confusing
我想了解 HTTP PUT 方法如何与 PHP 一起使用?
我在网上搜索了一下,找到了一些关于 cURL 的教程。
但我不知道如何使用它(像 REST API)。
$data = array("field" => "value");
$ch = curl_init($yourUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$response = curl_exec($ch);
我想了解 HTTP PUT 方法如何与 PHP 一起使用?
我在网上搜索了一下,找到了一些关于 cURL 的教程。
但我不知道如何使用它(像 REST API)。
$data = array("field" => "value");
$ch = curl_init($yourUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$response = curl_exec($ch);