将数组头信息转成字符
string Module_Storage_Driver_Swift::build_headers( array $headers )
参数列表
参数 类型 描述 默认值 $headers
array
$headers
string
protected function build_headers(array $headers)
{
$headers['Connection'] = 'keep-alive';
if (!isset($headers['X-Auth-Key']) && !isset($headers['X-Auth-User']))
{
# 加token
$headers['X-Auth-Token'] = $this->token;
}
if (!isset($headers['Date']))
{
$headers['Date'] = gmdate('D, d M Y H:i:s \G\M\T');
}
$header_str = '';
foreach ($headers as $key => $value)
{
$header_str .= trim($key) . ": " . trim($value) . "\r\n";
}
$header_str .= "\r\n";
return $header_str;
}