首页 > 解决方案 > Laravel 登录和注册页面不起作用

问题描述

安装 laravel 7 版本后,我立即安装ui: auth,运行php artisan ui bootstrap --auth命令(使用引导标记进行安装)。最初一切正常,我没有遇到任何问题,但现在进入页面(登录、注册、重置密码)时出现 404 错误。

web.php(路由文件)

<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| 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('/', 'MainController@index')->name('main'); 
Route::get('price', 'WorksController@index')->name('price'); 
Route::get('price/{slug}', 'WorksController@show')->name('single'); 
Route::get('about', 'AboutController@index')->name('about'); 
Route::get('news', 'NewsController@index')->name('news');
Route::get('news/{slug}', 'NewsController@show')->name('news_single'); 
Route::get('contact', 'ContactsController@index')->name('contacts'); 
Route::post('contact/send', 'MailSetting@send_form');
Route::get('/home', 'HomeController@index')->name('home');

Auth::routes();

Route::get('/home', 'HomeController@index')->name('home');

我没有改变任何东西,就在Auth::routes();我开始编写我的控制器和它们的路径之前。现在,如果我在 VCC(代码)中运行它,那么Auth::routes();在行上它说找不到该功能,但是如果我在 VCS(Studio)中打开相同的东西,那么这个错误就不再存在了。并且在调用php artisan route:list命令时,没有登录、密码、注册页面的路径。

标签: phplaravelauthenticationrouteshttp-status-code-404

解决方案


推荐阅读