<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國際加速解決方案。 廣告
                ## 文件上傳 MixPHP 的文件上傳類只用于處理已經上傳的文件,而對上傳文件的各種限制可在 “驗證器” 完成的。 ## 組件 使用 [composer]([https://www.phpcomposer.com/](https://www.phpcomposer.com/)) 安裝: ~~~ composer require mix/http-message ~~~ ## 獲取上傳的文件 - 通過 Request 對象直接獲: ``` $file = $request->getUploadedFiles()[$name] ?? null; if ($file) { $file->moveTo($targetPath); } ``` - 通過驗證器驗證后,自動實例化為表單類的屬性 >[info] 通常情況下都會使用該方法,因為文件都需經過驗證 表單驗證器源碼: [>> FileForm::class <<](https://github.com/mix-php/mix-skeleton/tree/v2.1/app/Api/Forms/FileForm.php) 通過表單驗證器保存文件: ~~~ // 使用表單驗證器 $form = new FileForm($request->getAttributes(), $request->getUploadedFiles()); $form->setScenario('upload'); if (!$form->validate()) { $content = ['code' => 1, 'message' => 'FAILED', 'data' => $form->getErrors()]; return SendHelper::json($response, $content); } // 保存文件 if ($form->file) { $targetPath = app()->basePath . '/runtime/uploads/' . date('Ymd') . '/' . $form->file->getClientFilename(); $form->file->moveTo($targetPath); } ~~~
                  <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>

                              哎呀哎呀视频在线观看