在我的應用程序中,當用戶訪問返回 BinaryFileResponse 的頁面時,他會斷開連接。當我在返回之前放置一個骰子時,我可以轉儲會話和用戶并重新加載而沒有任何問題,但是每次應用程序提供文件時,用戶都會在下一個請求中斷開連接......它讓我發瘋,因為我剛剛做了一個在問題出現之前作曲家更新...... :(我試圖關閉會話句柄。我嘗試了所有其他途徑……這是唯一一個丟棄安全令牌的途徑<?php // [...] $response = new BinaryFileResponse($f->filePath(),200,[],false); $disposition = HeaderUtils::makeDisposition( $fileManager->getDisposition($f), $f->getFilename() ); if($f->getEtag() !== null){ $response->setEtag($f->getEtag()); } $response->headers->set('Content-Disposition', $disposition); $response->headers->set('Content-Type', $f->getContentType()); return $response;它只是在下一個請求中刪除安全令牌......這與流式響應有關嗎?編輯:它只發生在 Chrome(最新的 macOS)上
添加回答
舉報
0/150
提交
取消