What is meant by Attaching Headers ?



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

Post New Answer

More Laravel PHP Framework Interview Questions

What are pros and cons of using laravel framework?

0 Answers  


Is laravel any good?

0 Answers  


Please write some additional where clauses in laravel?

0 Answers  


What is artisan in laravel?

0 Answers  


List the default ports that are forwarded to your homestead environment?

0 Answers  






Explain how to upgrade valet to valet 2.0?

0 Answers  


How to add multiple and conditions in laravel query?

0 Answers  


What are the difference between latest() and oldest() in laravel?

0 Answers  


How to share sites with external world on valet?

0 Answers  


What are the server requirements for laravel 6.0?

0 Answers  


How will you describe bundles in laravel?

0 Answers  


What is laravel api rate limit?

0 Answers  


Categories