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 to work with an Error in Laravel ?
Explain auth.
How does laravel handle assets?
What are the Writing Gates and Policies ?
How to install laravel via laravel installer.
How can we get data between two dates using query in laravel?
Explain validations in laravel?
What is remember token in laravel?
Is laravel object oriented?
What is a controller middleware?
What do you understand by unit testing?
What is the difference between forget() and the pull() method ?
How to set database connection in laravel?
How install react js in laravel?
How do I add a 3rd party package to your application like laravel-emoji?