What is Basic Response in Laravel ?



What is Basic Response in Laravel ?..

Answer / nafees ahmad

Laravel provides several different ways to return response.
Response can be sent either from route or from controller.
The basic response that can be sent is simple string as shown in the below sample code.
This string will be automatically converted to appropriate HTTP response.

Example :
Step 1 - Add the following code to app/Http/routes.php file.
app/Http/routes.php
Route::get('/basic_response', function () {
return 'Hai to One and All';
});

Step 2 - Visit the following URL to test the basic response.

http://localhost:8000/basic_response

Step 3 - The output will appear as shown in your screen.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Laravel PHP Framework Interview Questions

What is current stable version of laravel?

0 Answers  


What is meant by Laravel - Encryption ?

1 Answers  


Where will you define laravel's facades?

0 Answers  


What is the best backend for react?

0 Answers  


What does csrf token in laravel 5?

0 Answers  


What is repository in laravel?

0 Answers  


Have you used lumen before?

0 Answers  


Is laravel the best php framework?

0 Answers  


Why do we use laravel?

0 Answers  


How to generate application key in laravel? Why it is neccessary?

0 Answers  


List basic concepts in laravel?

0 Answers  


What is register method?

0 Answers  


Categories