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 |
Explain how to retrive all requested data in laravel?
What are the difference between laravel 5 & laravel 4?
What are facades?
How do I make a particular task run everyday by 10pm?
How to generate a request in laravel?
Explain the types of dependency injection?
What is meant by Attaching Headers ?
What is laravel spark?
What are the steps Redirecting to Named Routes in Laravel ?
What is Decryption Process ?
How to get, set cookies in laravel?
How to create Facade in Laravel ?