什么是“原始HTTP标头”? “HTTP标头”之间的区别是什么?和“原始HTTP标题”? [英] What is the "raw HTTP header"? What is the difference between "HTTP header" and "raw HTTP header"?

查看:398
本文介绍了什么是“原始HTTP标头”? “HTTP标头”之间的区别是什么?和“原始HTTP标题”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在响应类的Zend Framework中,有两个不同的数组用于存储标头: _headers [] _headersRaw [] 。并且有适当的方法来设置每一个:

In Zend Framework in Response Class there are two different arrays for storing headers: _headers[] and _headersRaw[]. And there are appropriate methods for setting each one:

setHeader(),getHeaders(),clearHeader()

setRawHeader(),getRawHeaders(),clearRawHeaders()

拥有标题和原始标题的原因是什么?实际上每个标题都有一些特殊用法吗?

What is the reason to have "header" and "raw header"? Is there some special kind of usage in practice for each of these headers?

推荐答案

使用setHeader设置关键值对而不用担心格式化例如

using setHeader you set key vale pair without worrying about there formatting e.g

$this->getResponse()->setHeader('Content-type','json');

而在setRawHeader()的情况下,你将整个/完整的标题放在正确的格式化

while in case of setRawHeader() you put the whole/full header as it is with proper formating

这篇关于什么是“原始HTTP标头”? “HTTP标头”之间的区别是什么?和“原始HTTP标题”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆