What is meant by Attaching Headers ?
Answer / 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 |
Explain events in laravel?
Please explain laravel query builder?
What are the types of service providers?
How can you generate urls?
How to assign multiple middleware to laravel route ?
What is the latest version of laravel?
How do I test sending emails without actually sending emails to real addresses?
Tell me what are pros and cons of using laravel framework?
Explain the concept of cookies.
How do you define middleware?
What is service container in laravel?
What are accessors and mutators in eloquent and why should you use them?