PHP Streaming MP3

后端 未结 7 723
情深已故
情深已故 2020-12-02 19:12

I have a very similar situation to the person who asked: Can I serve MP3 files with PHP? Basically I am trying to protect mp3 files from direct download, so users have to go

7条回答
  •  长情又很酷
    2020-12-02 20:16

    Two things stand out:

    1. You've got a Content-Length set. If you server is set to automatically gzip your output, this can mess with things. Try turning off Content-Length and see if that fixes it.
    2. You've got about a thousand Content-Types set. Since it's Mp3 that you're serving, just use audio/mpeg. You can effectively get rid of the whole last header() command. It's easy to get carried away with HTTP headers.

    Try it out and let us know how it goes!

提交回复
热议问题