Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/236.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在php中向标头添加新数组值_Php_Api_Http Headers_Postman - Fatal编程技术网

如何在php中向标头添加新数组值

如何在php中向标头添加新数组值,php,api,http-headers,postman,Php,Api,Http Headers,Postman,这是我的test_b.php文件: if(isset($_POST['username'])){ $url = 'http://my_url/test_b.php'; $x = get_headers($url, 1); print_r($x); } 我在邮递员中得到的输出如下: 我想在标题中的[Content Type]后面添加另一个参数,如[Authkey] 我是API开发新手。有人能帮忙吗。提前谢谢。在图像中覆盖您的URL,然后在代码中发布,这真是一件好事。到目前为止,您尝

这是我的test_b.php文件:

if(isset($_POST['username'])){
  $url = 'http://my_url/test_b.php';
  $x = get_headers($url, 1);
  print_r($x);
}
我在邮递员中得到的输出如下:

我想在标题中的[Content Type]后面添加另一个参数,如[Authkey]


我是API开发新手。有人能帮忙吗。提前谢谢。

在图像中覆盖您的URL,然后在代码中发布,这真是一件好事。到目前为止,您尝试了哪些不起作用的方法?谢谢您的通知。我忘了更改url。在php中有
header
函数。谷歌会告诉你的。
header('Authkey: your key');
if(isset($_POST['username'])){
    $url = 'http://localhost/jobs/ZikraBytes/starshow/test_b.php';
    $x =get_headers($url, 1);
    print_r($x);
}