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
What is mvc framework laravel?
What is an artisan? Name some common artisan commands?
What is active record in laravel?
What is the use of blade?
How to generate & update application key in laravel 5?
What is x-csrf-token?
How to use laravel framework in php?
What are route prefixes?
Which is better django or laravel?
What is the use of fillable in laravel?
What are the difference between laravel 5 & laravel 4?
What are named routes in laravel?
What is service provider in laravel?
Write down the name of some aggregates methods provided by the laravel's query builder.
How to use traits in laravel?