如何在此请求中添加Content-Type application/json


How to add Content-Type application/json in this request

我需要在下面的请求头中发送这个Content-Type-application/json。如何在头的数组中添加此函数中的Content-Type application/json?

function sendOrder($arField){
$body='{
}';
$head=array("Authorization: ".$data['scheme']." ".$data['token']);
$data=self::getData("https://example.com",$body,$head);
return $data;
}

用替换现有行

$head=array("Authorization: ".$data['scheme']." ".$data['token'], "Content-Type: application/json");

应该是你需要做的全部。