繁体   English   中英

当我运行项目时,它显示控制器没有在 laravel 中退出,但它在控制器文件夹中,我在做什么?

[英]when i run project it shows controller does not exit in laravel , but it there in controllers folder what i do?

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

use Illuminate\Support\Facades\Route;

Route::get('/',function () {
  
  return view('welcome');
});

Route::get('/sample', 'SampleController@index');

例子.blade.php

<?php
echo 'hello world !!';
?>

我希望你正在使用 Laravel 8 并且它现在更新了,

use App\Http\Controllers\SampleController;

Route::get('/sample', [SampleController::class, 'index']);

请在此处查看更多详细信息, https://laravel.com/docs/8.x/routing

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM