PHP:发送header数据和body数据有什么区别?
PHP: What is the difference between sending header data and body data?
我目前正在使用 Slim Framework 构建一个 API,我一直在研究如何发送 API credentials/keys。我经常看到有人参考 header 信息发送 API 密钥。我的问题是为什么该方法优于仅通过 body 变量发送此数据?
谢谢!
认为 best-practice 将它们放在 header 中,因为这是它们的设计目的。
参考:https://en.wikipedia.org/wiki/List_of_HTTP_header_fields
查看授权 header
我目前正在使用 Slim Framework 构建一个 API,我一直在研究如何发送 API credentials/keys。我经常看到有人参考 header 信息发送 API 密钥。我的问题是为什么该方法优于仅通过 body 变量发送此数据?
谢谢!
认为 best-practice 将它们放在 header 中,因为这是它们的设计目的。
参考:https://en.wikipedia.org/wiki/List_of_HTTP_header_fields 查看授权 header