如何防止在PHP中下载MP3文件? [英] How to prevent downloading of MP3 file in PHP?

查看:163
本文介绍了如何防止在PHP中下载MP3文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个PHP脚本负责将MP3文件输出和流式传输到浏览器,我的问题是

I have a PHP script that is responsible for outputing and streaming MP3 files to the browser, my questions is

如何防止下载MP3文件?

How can I prevent downloading the MP3 file?

*知道我尝试使用HTTP Referrer并且它可以(仅在本地主机上)检测文件的直接下载但在我的服务器上无法工作

*knowing that I tried using HTTP Referrer and it worked ((only on my localhost)) detecting the direct downloads of the file but not on my server

推荐答案


如何防止下载MP3文件?

How can I prevent downloading the MP3 file?

您不能。

您不能以某人无法接收数据的方式发送数据。如果他们可以播放,则可以下载。动作相同。

You can't send someone data in a way that they can't receive the data. If they can play it, they can download it. It's the same action.

充其量,您可以使用唯一的标识符对媒体进行数字水印处理,以便在有人重新共享内容时可以对其进行追溯。您还可以通过使用签名的URL或一次性使用(或时间限制)的URL来防止他人共享媒体链接。

At best, you can digitally watermark your media with unique identifiers so that if someone re-shares the content, you can trace it back. You can also prevent someone from sharing a link to media by using signed URLs or otherwise one-time-use (or time-limited) URLs.

这篇关于如何防止在PHP中下载MP3文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆