php - PHP:用于 litespeed 的 x-sendfile
问题描述
我将以下代码用于 apache:
$file = 'a.mp3';
$mime = mime_content_type($file);
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Content-type: ' . $mime);
header('Content-Length: ' . filesize($file));
header('X-Sendfile: ' . $file);
exit();
但是新的服务器管理员要求我将其更改为 litespeed 版本
如何 ?
解决方案
试试下面的代码
$file = 'https://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4';
$mime = 'video/mp4';
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Content-type: ' . $mime);
header('Content-Length: ' . filesize($file));
// header('X-Sendfile: ' . $file);
header('X-LiteSpeed-Location:' . $file);
exit();
推荐阅读
- pyspark - WARN TaskMemoryManager:302 - 分配页面失败(16777216 字节),再试一次
- git - 如何在 Git 中以 root 身份克隆特定的子目录?
- azure-cosmosdb - 在 cosmos db 中转换 JSON 结构
- ios - 此应用无法在中国激活 CallKit 功能时获得批准。请进行适当的更改并重新提交此应用以供审核
- c# - 根据输出的xml修改xslt
- turi-create - 如何在 mac 中安装 turicreate
- c# - 从 ado.net 而不是 DataTable 返回任何类型的数据列表
- python-3.x - Numpy 数组中对象的大小:Sympy Points 示例
- ruby-on-rails - 如何在 Rails 项目中使用 secure_yaml 解密和使用加密的 database.yml?
- asp.net-core - 在 .NET Core 2.1.0-rc1-final 中使用 System.Net.Http.SocketsHttpHandler