Answer Posted / surbhi
The response can be attached to headers using the header() method.
We can also attach the series of headers as shown in the below sample code.
return response($content,$status)
->header('Content-Type', $type)
->header('X-Header-One', 'Header Value')
->header('X-Header-Two', 'Header Value');
Example : Route::get('/header',function(){
return response("Hello", 200)->header('Content-Type', 'text/html');
});
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How can you display html with blade in laravel?
How to clear cache in laravel?
How to register a middleware in laravel?
List site types supported by homestead?
What are the advantages of queue?
Can I use react with laravel?
What is laravel dusk?
How to use skip() and take() in laravel query?
Explain collections in laravel.
What is meant by check method ?
What is meant by Logging ?
What is a controller middleware?
Do you know what is laravel elixir?
Can you exclude uris from csrf protection in laravel? Explain
How to clear complete cache in laravel?