<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                # 增加控制器、路由 ## 生成控制器 ### 主頁 ~~~bash > php artisan make:controller IndexController ~~~ ### 文章 ~~~bash > php artisan make:controller ArticlesController ~~~ ## 添加方法 ### 主頁 `app/Http/Controllers/IndexController.php` ~~~php class IndexController extends Controller { public function index(){ return view('index.index.index'); } } ~~~ ### 文章 `app/Http/Controllers/ArticlesController.php` ~~~php class ArticlesController extends Controller { public function category() { return view('index.articles.show'); } public function show() { return view('index.articles.show'); } } ~~~ ## 增加路由 路徑 `routes/web.php` ~~~php ... use App\Http\Controllers\ArticlesController; use App\Http\Controllers\IndexController; ... Route::get('/', [IndexController::class, 'index']) ->name('index'); Route::get('/categories/{article_category}.html', [ArticlesController::class, 'category']) ->name('articles.category'); Route::get('/articles/{article}.html', [ArticlesController::class, 'show']) ->name('articles.show'); ~~~ > 建議每個路由都起一個別名 這樣組裝路由的時候可以直接使用別名 `{$表名}` 這樣寫參數可以在方法里面用模型注入的方式直接獲取id對應的數據
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看