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');
}
}
web.php
<?php
use Illuminate\Support\Facades\Route;
Route::get('/',function () {
return view('welcome');
});
Route::get('/sample', 'SampleController@index');
example.blade.php
<?php
echo 'hello world !!';
?>
I hope you are using Laravel 8 and its now updated,
use App\Http\Controllers\SampleController;
Route::get('/sample', [SampleController::class, 'index']);
Pls check further details here, https://laravel.com/docs/8.x/routing
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.