我创建了一个带有网络路由的控制器。如果我在浏览器中发出请求,我会得到输出,但是当我尝试调试时,我在调试控制台中收到以下错误:
PHP 致命错误:未捕获错误:在 /home/payarc/Desktop/myDummy/routes/web.php:21 中找不到类“Illuminate\Support\Facades\Route”
堆栈跟踪:
#0 {主要}
扔进 /home/payarc/Desktop/myDummy/routes/web.php 第 21 行
如何解决这个错误?
web.php
<?php
use App\Http\Controllers\UserController;
use Illuminate\Support\Facades\Route;
Route::get('/div',[UserController::class,'dummy']);
UserController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class UserController extends Controller
{
public function dummy(){
$a=5;
$b=0;
$c=$a+$b;
echo $c;
}
}