Laravel 5.7 route create systematically produced 404 抱歉,找不到您要找的页面
Laravel 5.7 route create systematically produced 404 Sorry, the page you are looking for could not be found
当我使用 http://localhost:8000/books/create
时,我的 'create' 路由总是产生 404 错误
我的 routes/web.php 文件包含:
路由::中间件('role:adm|user')->组(函数(){
Route::get('books', 'BooksController@index')->name('books.index');
Route::get('books/{book}', 'BooksController@show')->name('books.show');
Route::get('books/{book}/edit', 'BooksController@edit')->name('books.edit');
Route::put('books/{book}', 'BooksController@update')->name('books.update');
});
路由::中间件('role:adm')->组(函数(){
Route::get('/books/create', 'BooksController@create')->name('books.create');
Route::post('books', 'BooksController@store')->name('books.store');
Route::delete('books/{book}', 'BooksController@destroy')->name('books.destroy');
});
奇怪的是,如果我删除 'show' 路由,'create' 路由会正常工作
提前致谢
/books/create 在技术上匹配 books/{book} 语法,并且正在匹配。如果您首先定义 /books/create 路由,应该将其放在更早的路由 table 中,事情可能会起作用。
当我使用 http://localhost:8000/books/create
时,我的 'create' 路由总是产生 404 错误我的 routes/web.php 文件包含:
路由::中间件('role:adm|user')->组(函数(){
Route::get('books', 'BooksController@index')->name('books.index');
Route::get('books/{book}', 'BooksController@show')->name('books.show');
Route::get('books/{book}/edit', 'BooksController@edit')->name('books.edit');
Route::put('books/{book}', 'BooksController@update')->name('books.update');
});
路由::中间件('role:adm')->组(函数(){
Route::get('/books/create', 'BooksController@create')->name('books.create');
Route::post('books', 'BooksController@store')->name('books.store');
Route::delete('books/{book}', 'BooksController@destroy')->name('books.destroy');
});
奇怪的是,如果我删除 'show' 路由,'create' 路由会正常工作
提前致谢
/books/create 在技术上匹配 books/{book} 语法,并且正在匹配。如果您首先定义 /books/create 路由,应该将其放在更早的路由 table 中,事情可能会起作用。