【发布时间】:2017-05-12 23:55:08
【问题描述】:
所以,在 Laravel 中有一个 web.php 文件,其中使用了类 Route,并调用了它的静态函数 get 和 match。
问题是,这个类对我来说是一种谜,我在我的 laravel 项目中找不到它的源代码,我在互联网上也找不到任何关于它的信息。 如果你用谷歌搜索,你会找到 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('/', 'BlogController@all')->name('post.all');
Route::match(['get', 'post'], '/article/create', 'BlogController@create')->name('post.create')
->middleware('auth');
Route::get('/article/{id}', 'BlogController@single')->name('post.single');
Route::match(['get', 'post'], '/article/{id}/delete', 'BlogController@delete')->name('post.delete')
->middleware('auth', 'author');
Route::match(['get', 'post'], '/article/{id}/edit', 'BlogController@edit')->name('post.edit')
->middleware('auth', 'author');
Route::get('/author/{id}', 'BlogController@author')->name('post.author');
Route::get('/category/{id}', 'BlogController@category')->name('post.category');
Route::match(['get', 'post'], '/user/create', 'UserController@create')->name('user.create')
->middleware('auth');
Route::get('/home', 'HomeController@index');
【问题讨论】: