PHP files are streamed in a streaming way
Scene:
The client gets the MP3 file on the server to play, but for some reason the client cannot write the file, that is, the operation cannot be downloaded.
The idea now is to read the MP3 buffer into memory with fopen-fread->echo on the PHP side, and the client receives the buffer in memory and plays the sound in memory.
Problem:
Now there is a 5143-byte Mp3 on the server, but the client only receives 5042. Test is that some characters are escaped, in the Internet to find a lot of methods, seems to be not good, PHP learned, what method can let him do not escape to get the correct file buffer.
file Stream Stream Mode Transfer
Share to:
------Solution--------------------
fopen using ' RB ' to open
------Solution--------------------
yge.me/ Xx.mp3/index.php
index.php
Header ("Location:http://yge.me/x.mp3");
The full URL address of the MP3.
X.mp3 for Real files
?>
------Solution--------------------
1, with Echo file_get_contents (' filename '); No other issues to consider
2, with ReadFile (' filename '); No other issues to consider
3, the client can write files, not the service side can control things
------Solution--------------------
I have a question, your PHP will not be sent to the header, right? What header?