所以,在Laravel,有在使用類路由一個web.php文件,它的靜態函數獲取和匹配稱爲類路徑。我想了解一下web.php使用
的問題是,這個類是怎樣的一個謎給我的,我無法找到它在我的laravel項目源,niether可以找到關於它的任何互聯網。 如果你谷歌它,你會發現Illuminate \ Routing \ Route,但我認爲這不是我正在尋找的類,因爲那個沒有靜態函數獲取和匹配。 我也試過尋找它,我的項目目錄,我發現我認爲這樣的名稱的四個類,但他們都沒有這些功能,這是在我的web.php中使用。
這裏是我的web.php:
<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', function() {
return view('welcome');
});
Auth::routes();
Route::get('/', '[email protected]')->name('post.all');
Route::match(['get', 'post'], '/article/create', '[email protected]')->name('post.create')
->middleware('auth');
Route::get('/article/{id}', '[email protected]')->name('post.single');
Route::match(['get', 'post'], '/article/{id}/delete', '[email protected]')->name('post.delete')
->middleware('auth', 'author');
Route::match(['get', 'post'], '/article/{id}/edit', '[email protected]')->name('post.edit')
->middleware('auth', 'author');
Route::get('/author/{id}', '[email protected]')->name('post.author');
Route::get('/category/{id}', '[email protected]')->name('post.category');
Route::match(['get', 'post'], '/user/create', '[email protected]')->name('user.create')
->middleware('auth');
Route::get('/home', '[email protected]');