2016-08-03 37 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

相關問題