I have made a program that requires a request header in the curl function, but when I run the program the following message appears: You must pass either an object or an array with the CURLOPT_HTTPHEADER argument
请帮助确定
我使用功能曲线(......)——头盔,但结果仍然不变。
$headers = array();
$headers[] = User-Agent: Spotify-Lite/0.13.26.56 Android/25 (vivo 1719) ;
$headers[] = Content-Type: application/x-www-form-urlencoded ;
$headers[] = Connection: Keep-Alive ;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
警告:治疗 你必须穿过CURLOPT的物体或阵列。 HTTPHEADER 论点