gpt4 book ai didi

php - PHP 中的多值请求 header

转载 作者:可可西里 更新时间:2023-11-01 17:06:08 24 4
gpt4 key购买 nike

假设我有一个全新的 Symfony 2.8 或 3.2 安装。在我的主 Controller 操作中,我这样做:

dump($request->headers->all());

启动内置网络服务器并使用 curl 发送此请求后,

curl 'http://localhost:8000' -H 'accept-encoding: gzip' -H 'accept-encoding: deflate' -H 'accept-encoding: identity'

我得到了这个“accept-encoding” header 值:

[accept-encoding] => Array
(
[0] => gzip
)

我希望数组中也有另外两个值。这种情况不仅发生在“accept-encoding” header 中,也发生在其他 header 中,以这种方式定义了多个值。

PHP 不处理吗?我正在使用 PHP 7.0。

最佳答案

您必须传递以逗号分隔的 header 值:curl 'http://localhost:8000' -H 'accept-encoding: gzip, deflate, identity'

关于php - PHP 中的多值请求 header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41848992/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com