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

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # 發布微博 微博的創建與刪除原理和用戶的相關操作是一樣的,只不過把對象換成了微博而已 ## 微博控制器 現在來創建一個微博相關的控制器。 打開命令行并鍵入: `php think make:controller user/Post --plain` `--plain` 表示生成一個空控制器。 `application\user\controller\Post.php` ~~~php <?php namespace app\user\controller; use think\Controller; use think\Request; use app\User\model\Post as PostModel; class Post extends Controller { protected $middleware = [ 'UserAuthorize' => [ 'only' => [ 'save', ] ] ]; public function save(Request $request) { PostModel::create([ 'content' => $request->content, 'user_id' => session('user.id') ]); return redirect('/'); } } ~~~ 雖然我們還未創建前端頁面,但是能夠從基本的發布流程中來編寫后端邏輯,現在來編輯頁面。 `resources\views\welcome\index\home.blade.php` ~~~html @extends('_layout.default') @section('title', '主頁') @section('content') <div> <form action="{{ url('user/post/save') }}" method="POST"> @php echo token() @endphp <div class="form-group"> <textarea class="form-control" rows="3" name="content"></textarea> </div> <div class="text-right"> <button type="submit" class="btn btn-primary mt-3">發布</button> </div> </form> </div> @stop ~~~ 現在訪問主頁:http://thinkphp.test ,即可看到輸入框,可是現在路由還未綁定,編輯路由。 `route\route.php` ~~~php ... Route::resource('post', 'user/post')->only(['save']); ... ~~~ 需要注意的是,后面的 `->only` 表示只通過控制器的某一個方法。 再次訪問:http://thinkphp.test 并在輸入框內輸入一些內容點擊發布,正常跳轉。 訪問個人資料頁面:http://thinkphp.test/user/auth/read/id/1.html 就能夠看到剛剛發布的內容了。
                  <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>

                              哎呀哎呀视频在线观看