我正在尝试向我的服务器发出 put 请求,但是当我调用它时没有任何反应。这是我所拥有的:
$url = ("http://my.server/api/");
$data = array("{\"bri\": 254, \"on\": true,\"bri\": 10}" => $a);
$ch = curl_init($url);
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);
if(!$response) {
return false;
}