標籤

bat (54) 作品 (41) python (24) shell (17) windows (11) 虛擬機 (11) php (10) laravel (9) CPP (6) KMS (6) 程式設計 (6) docker (5) xoops (5) 使用教學 (5) 公文 (4) Apache2 (3) Excel (3) juniper (3) 資料庫 (3) 轉檔 (3) mysql (2) 免動手 (2) 資料結構 (2) 軟體廣播 (2) 電腦維修 (2) Android Studio (1) Apple IPAD管理 (1) Arduino (1) CSS (1) LAMP (1) NAS (1) Ubuntu (1) VHD (1) Windows Server (1) 原因 (1) 程式應用 (1) 程式積木 (1) 編輯器 (1) 雲端硬碟 (1)

2025年5月30日 星期五

laravel 12 route 路由

測試指令:
php artisan serve

檔名:routes/web.php
內容:
Route::get('/',function(){
    return "Hello! World";
});
Route::get('about',function(){
    return "about us";
});

Route::prefix('details')->group(function(){
    Route::get('students',function(){
        return "this is student";
    })->name('student-Details');
    Route::get('teachers',function(){
        return "this is teacher";
    })->name('teacher-Details');
});

Route::get('student/{id}/{reg}',function($id,$reg){
    return 'student number '.$id. ' registration number '.$reg;
});

Route::fallback(function(){
    return "This page is no found please try again";
});

顯示所有可用路由指令:
php artisan route:list


此時,在瀏覽器網址列輸入http://127.0.0.1:8000/up






資料來源:

沒有留言:

張貼留言

laravel 12 Controller 控制器

一、Controller 控制器  1.指令建立控制器 php artisan make:controller StudentController    2.在app/Http/Controllers/StudentController.php 新增一個函式     public...