2016-08-03 35 views
0

我需要在以下请求的标头中发送此Content-Type - application/json。 如何在这个函数中添加Content-Type应用程序/ json在一个head的数组中?如何在此请求中添加内容类型应用程序/ json

function sendOrder($arField){ 

$body='{ 
}'; 

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

回答

0

与替换现有行:

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

应该是所有你需要做的。

+0

谢谢你的回答! – spinet

相关问题