Php 当我运行该项目时,它显示控制器并没有在laravel中退出,但它显示在控制器文件夹中,我在做什么?
SampleController.php、web.php、example.blade.phpPhp 当我运行该项目时,它显示控制器并没有在laravel中退出,但它显示在控制器文件夹中,我在做什么?,php,laravel,controller,Php,Laravel,Controller,SampleController.php、web.php、example.blade.php <?php namespace App\Http\Controllers; use Illuminate\Http\Request; class SampleController extends Controller { public function index(){ return view('example'); } } <?php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class SampleController extends Controller
{
public function index(){
return view('example');
}
}
<?php
use Illuminate\Support\Facades\Route;
Route::get('/',function () {
return view('welcome');
});
Route::get('/sample', 'SampleController@index');
<?php
echo 'hello world !!';
?>
我希望您使用的是Laravel 8及其现在的更新版
use App\Http\Controllers\SampleController;
Route::get('/sample', [SampleController::class, 'index']);
请在此查看更多详细信息,
欢迎来到SO。。。请包括您收到的错误以及您使用的是什么版本的Laravel您如何确定他使用的是Laravel 8.x?我确信,此方法已在Laravel 8中更新,