小编Man*_*lis的帖子

Php readfile - 强制下载

我正在使用flash播放器播放一些mp3文件.在Firefox,它正常加载它们,但在IE浏览器它没有.当我转到.mp3文件的URL时,它显示了mp3的源代码(而不是提供例如下载).所以我使用一个小脚本来修复它:

$url = $_GET['url'];
header('Content-type: application/force-download');
header('Content-Transfer-Encoding: Binary');
header("Content-disposition: attachment; filename=demo.mp3");
readfile($url);
Run Code Online (Sandbox Code Playgroud)

我想问你以上是否安全.此外,服务器是否通过这种方式损失带宽?最后,它是否会影响服务器的资源?谢谢.

php readfile

4
推荐指数
2
解决办法
2841
查看次数

标签 统计

php ×1

readfile ×1