<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之旅 廣告
                #### 用法 配置文件 config/filesystem.php ~~~php <?php return [ // 默認磁盤 'default' => env('filesystem.driver', 'local'), // 磁盤列表 'disks' => [ 'local' => [ 'type' => 'local', 'root' => app()->getRuntimePath() . 'storage', ], 'public' => [ // 磁盤類型 'type' => 'local', // 磁盤路徑 'root' => app()->getRootPath() . 'public/storage', // 磁盤路徑對應的外部URL路徑 'url' => '/storage', // 可見性 'visibility' => 'public', ], // 更多的磁盤配置信息 ], ]; ~~~ 控制器 app/controller/Index.php ~~~php <?php namespace app\controller; class Index { public function index() { return view('index'); } public function upload(){ // 獲取表單上傳文件 例如上傳了001.jpg $file = request()->file('image'); // 上傳到本地服務器 $savename = \think\facade\Filesystem::putFile( 'topic', $file); //$savename = \think\facade\Filesystem::disk('public')->putFile( 'topic', $file); echo $savename; } } ~~~ 視圖 app/view/index/index.html ~~~xml <form action="/index/upload" enctype="multipart/form-data" method="post"> <input type="file" name="image" /> <br> <input type="submit" value="上傳" /> </form> ~~~ 測試(上傳圖片,查看runtime/storage下是否生成對應文件) ~~~perl http://127.0.0.1:8000/index ~~~ #### 多文件上傳 視圖 ~~~xml <form action="/index/index/upload" enctype="multipart/form-data" method="post"> <input type="file" name="image[]" /> <br> <input type="file" name="image[]" /> <br> <input type="file" name="image[]" /> <br> <input type="submit" value="上傳" /> </form> ~~~ 控制器 ~~~php public function upload(){ // 獲取表單上傳文件 $files = request()->file('image'); $savename = []; foreach($files as $file){ $savename[] = \think\facade\Filesystem::putFile( 'topic', $file); } } ~~~ 驗證 ~~~php public function upload(){ // 獲取表單上傳文件 $files = request()->file(); try { validate(['image'=>'fileSize:10240|fileExt:jpg|image:200,200,jpg']) ->check($files); $savename = []; foreach($files as $file) { $savename[] = \think\facade\Filesystem::putFile( 'topic', $file); } } catch (\think\exception\ValidateException $e) { echo $e->getMessage(); } } ~~~ 驗證參數 ~~~undefined 驗證參數 說明 fileSize 上傳文件的最大字節 fileExt 文件后綴,多個用逗號分割或者數組 fileMime 文件MIME類型,多個用逗號分割或者數組 image 驗證圖像文件的尺寸和類型 ~~~
                  <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>

                              哎呀哎呀视频在线观看