【发布时间】:2019-12-09 01:07:13
【问题描述】:
在我的应用程序中,当用户访问返回 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)上
【问题讨论】:
标签: php apache symfony session nginx