【问题标题】:How to add new array value to header in php如何在php中将新数组值添加到标头
【发布时间】:2019-04-04 07:20:42
【问题描述】:

这是我的 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,然后将其发布到您的代码中,做得很好。到目前为止,您尝试过哪些不起作用的方法?
  • 感谢您的告知。我忘了更改网址。哈哈。
  • php中有header函数。谷歌搜索会告诉你。

标签: php api http-headers postman


【解决方案1】:
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);
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-11-01
    • 2012-08-21
    • 2020-03-12
    • 2012-01-17
    • 2016-07-22
    • 2017-11-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多