Home > Article > Backend Development > php receives binary stream, php receives binary_PHP tutorial
/**Binary stream generated file
* $_POST cannot interpret binary stream, you need to use $GLOBALS['HTTP_RAW_POST_DATA'] or php://input
* Neither $GLOBALS['HTTP_RAW_POST_DATA'] nor php://input can be used 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']; // php.ini settings are required
if(empty($content)){
$content = file_get_contents('php://input'); // php.ini settings are not required, Low memory pressure
}
);
www.bkjia.com