国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

webman 是否可以支持tus-php實(shí)現(xiàn)的 tus 服務(wù)端?

Van Chin

問題描述

因需要上傳大文件,支持?jǐn)帱c(diǎn)續(xù)傳,就找到 https://github.com/ankitpokhrel/tus-php

但集成在 webman 中 tus服務(wù)端 headers 中 無法響應(yīng)返回 協(xié)議需要的對下字段

Access-Control-Expose-Headers: Upload-Key, Upload-Checksum, Upload-Length, Upload-Offset, Upload-Metadata, Tus-Version, Tus-Resumable, Tus-Extension, Location
Workerman version:4.1.15          PHP version:8.2.20           Event-Loop:\Workerman\Events\Event
workerman/webman-framework: 1.5.24

簡單代碼片段

<?php

//  路由 實(shí)際只使用了 post 和 patch 方法 /files/tus/**
Route::any('/files/tus/[{path:.+}]', [App\Tms\Controllers\V1\FileController::class, 'tus']);
<?php

use TusPhp\Tus\Server as TusServer;

class FileController extends Controller
{
    /**
    * tus的服務(wù)端
    */
    public function tus() {
        $tusServer   = new TusServer('file');

        $tusServer->setUploadDir(public_path('files/tus'));

        // return $tusServer->send();
        return $tusServer->serve();
    }
}

為此你搜索到了哪些方案及不適用的原因

  1. 個(gè)人猜測和 webman/workman 的 Response 不兼容,tus-php 使用的是 Symfony\Component\HttpFoundation\Response 但感覺又是用的 webman 的 Response 返回的
  2. 還有一個(gè)可能的原因就是跨域,但我已經(jīng)做了跨域的相關(guān)處理(跨域應(yīng)該可以排除)

截圖

截圖
截圖
截圖

參考資料

https://tus.io/protocols/resumable-upload

https://github.com/ankitpokhrel/tus-php

499 2 0
2個(gè)回答

walkor 打賞

不兼容,用不了

  • 暫無評論
故人重來

為什么要用別人寫好的插件呢,直接封裝一個(gè)不就可以了。斷點(diǎn)續(xù)傳沒必要直接用切片上傳。我測試本地切片上傳 1G數(shù)據(jù),切片成5MB也就是30S時(shí)間,線上也就是大概 2分鐘左右,看你服務(wù)器帶寬,切片實(shí)現(xiàn)邏輯也簡單。

  • 暫無評論
??