Home > Backend Development > PHP Tutorial > php receives binary stream

php receives binary stream

WBOY
Release: 2016-07-30 13:31:33
Original
1866 people have browsed it

/**Binary stream generated file
* $_POST cannot interpret binary stream, you need to use $GLOBALS['HTTP_RAW_POST_DATA'] or php://input
* * $GLOBALS['HTTP_RAW_POST_DATA'] and php://input cannot be used for enctype= multipart/form-data
* @param String $file The file path to be generated
* @return boolean
*/
function binary_to_file($file){
$content = $GLOBALS['HTTP_RAW_POST_DATA']; // Requires php.ini settings
if(empty($content)){
$content = file_get_contents('php://input'); // No php.ini settings required, low memory pressure
                                                                                                     binary_to_ ('photo/test.png');

The above introduces how to receive binary streams in PHP, including some aspects. I hope it will be helpful to friends who are interested in PHP tutorials.


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template