Laravel 5.2 different routing types
I'm new to Laravel but learning fast. The documentation about Routing says the following:
Route::get($uri, $callback);
Route::post($uri, $callback);
Route::put($uri, $callback);
Route::patch($uri, $callback);
Route::delete($uri, $callback);
Route::options($uri, $callback);
I can code in PHP and know what POST and GET requests are. And also know how to update and delete records via SQL. But why are there so many Route types, aren't POST and GET enough?
And in which situations should I use the PUT
, PATCH
, DELETE
or OPTIONS
route?
Thanks in advance.
Theo
That is because it follows the architecture defined by REST specification. The Laravel documentation explains it a little and also shows a table of which method uses what. But, basically, it is:
上一篇: 需要帮助将API PUT方法添加到Python脚本
下一篇: Laravel 5.2不同的路由类型