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

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ## 第4節 路由 ~~~ git checkout -b route ~~~ ### 簡介 Laravel 5.2 中路由的位置:`D:\wamp\www\newblog.com\app\Http\routes.php` ~~~ <?php /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ Route::get('/', function () { return view('welcome'); }); Route::auth(); Route::get('/home', 'HomeController@index'); ~~~ 路由:<http://d.laravel-china.org/docs/5.2/routing> ### 4.1 基礎路由 ~~~ Route::get('/', function () { return view('welcome'); }); ~~~ 最基本的 Laravel 路由僅接受 URI 和一個閉包。 上面自帶的路由就是訪問放在的根目錄時,返回一個 `resources\views\welcome.blade.php` 視圖文件。 ~~~ @extends('layouts.app') @section('content') <div class="container"> <div class="row"> <div class="col-md-10 col-md-offset-1"> <div class="panel panel-default"> <div class="panel-heading">Welcome</div> <div class="panel-body"> Your Application's Landing Page. </div> </div> </div> </div> </div> @endsection ~~~ 關于視圖的內容,我們在后面的章節再詳述吧! 是不是可以看到 “Your Application's Landing Page.”內容輸出了? ![](https://box.kancloud.cn/71745a3e25b898258f0259ee208e515f_1046x414.png) 其實這種閉包路由使用的不多,我們使用的更多的是控制器路由。 ~~~ Route::get('/home', 'HomeController@index'); ~~~ 關于 `Route::auth();` 這條路由,其實是系統自定義好的。在:`D:\wamp\www\newblog.com\vendor\laravel\framework\src\Illuminate\Routing\Router.php` ~~~ public function auth() { // Authentication Routes... $this->get('login', 'Auth\AuthController@showLoginForm'); $this->post('login', 'Auth\AuthController@login'); $this->get('logout', 'Auth\AuthController@logout'); // Registration Routes... $this->get('register', 'Auth\AuthController@showRegistrationForm'); $this->post('register', 'Auth\AuthController@register'); // Password Reset Routes... $this->get('password/reset/{token?}', 'Auth\PasswordController@showResetForm'); $this->post('password/email', 'Auth\PasswordController@sendResetLinkEmail'); $this->post('password/reset', 'Auth\PasswordController@reset'); } ~~~ 看下:` $this->get('login', 'Auth\AuthController@showLoginForm');` 這條路由訪問的頁面效果: ![](https://box.kancloud.cn/2ee69b18a00b2b685118919c89de49a4_1046x541.png) 它實際上訪問的是 `AuthController` 控制器的 `showLoginForm` 方法。 *\vendor\laravel\framework\src\Illuminate\Foundation\Auth\AuthenticatesUsers.php* ~~~ public function showLoginForm() { $view = property_exists($this, 'loginView') ? $this->loginView : 'auth.authenticate'; if (view()->exists($view)) { return view($view); } return view('auth.login'); } ~~~ 是不是可以感受到路由的強大之處?好了,這里先不要糾結,后面也就慢慢可以理解了。 關于更多的路由知識,大家可以借助手冊進一步了解,如路由群組、路由別名等概念,這里就不做詳述了! ### 4.2 使用 artisan 查看路由列表 命令: ~~~ php artisan route:list ~~~ ![](https://box.kancloud.cn/dffc23e371f032305c4783f1c21b957f_1366x485.png)
                  <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>

                              哎呀哎呀视频在线观看