/**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.