讨论数量:
github.com/laravel/framework/blob/...
/**
* Add an array of headers to the response.
*
* @param \Symfony\Component\HttpFoundation\HeaderBag|array $headers
* @return $this
*/
public function withHeaders($headers)
{
if ($headers instanceof HeaderBag) {
$headers = $headers->all();
}
foreach ($headers as $key => $value) {
$this->headers->set($key, $value);
}
return $this;
}
推荐文章: