Php Symfony BinaryFileResponse在文件名带有重音时强制下载文件
我试图在Symfony控制器中的BinaryFileResponse的帮助下直接在浏览器中显示图像 在我们以前的服务器上,此代码运行良好:Php Symfony BinaryFileResponse在文件名带有重音时强制下载文件,php,symfony,symfony-2.8,Php,Symfony,Symfony 2.8,我试图在Symfony控制器中的BinaryFileResponse的帮助下直接在浏览器中显示图像 在我们以前的服务器上,此代码运行良好: $response = new BinaryFileResponse($filePath, 200, [], true, null, true); $response->headers->addCacheControlDirective('no-cache', true); $response->headers->addCach
$response = new BinaryFileResponse($filePath, 200, [], true, null, true);
$response->headers->addCacheControlDirective('no-cache', true);
$response->headers->addCacheControlDirective('max-age', 0);
$response->headers->addCacheControlDirective('must-revalidate', true);
$response->headers->addCacheControlDirective('no-store', true);
return $response;
但是由于迁移是在新服务器上进行的,当$filePath包含重音符号(èè等)时,它会强制下载图像,而不仅仅是显示图像
两台服务器都安装了PHP7.0.10
我是否缺少一个配置或什么?我不明白为什么会这样
非常感谢您的帮助。谢谢。我发现了我的问题
Symfony无法在包含重音符号的路径中获取文件类型mime。为了使之成为可能,我必须在Apache中激活PHP扩展PHP_fileinfo