简体   繁体   English

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

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

I need to send this Content-Type - application/json in headers of the request below. 我需要在以下请求的标头中发送此Content-Type-application / json。 How to add Content-Type application/json in this function in a head's array? 如何在头部数组中的此函数中添加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;
}

Replacing the existing line with: 用以下内容替换现有的行:

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

Should be all you need to do. 应该是您所需要做的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM