我正在尝试向我的服务器发出一个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;
}