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 is csrf protection token?

0 Answers  


what is Laravel-Routing ?

1 Answers  


What is meant by Laravel - Validation ?

1 Answers  


Explain how to generate pretty urls in laravel?

0 Answers  


How to assign a variable value for all view file?

0 Answers  






What directories that need to be writable laravel installation?

0 Answers  


Can you update homestead? If yes, how?

0 Answers  


What is chunk in laravel?

0 Answers  


What is meant by Implicit Controllers

1 Answers  


Explain the concept of cookies.

0 Answers  


What are Global Middleware and Route Middleware ?

0 Answers  


Explain short notes on Laravel - Artisan Console and commands ?

0 Answers  


Categories