簡體   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