Php receives binary streams, php receives binary _ PHP Tutorial

Source: Internet
Author: User
Php receives binary streams, and php receives binary streams. Php receives binary streams. php receives binary ** binary stream generated files * $ _ POST. binary streams cannot be interpreted. you need to use $ GLOBALS [HTTP_RAW_POST_DATA] or php: input * $ GLOBALS [php receives binary streams, and php receives binary streams

/** Generate a binary stream file
* $ _ POST cannot interpret binary streams. $ 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: Path of the file to be generated
* @ Return boolean
*/
Function binary_to_file ($ file ){
$ Content = $ GLOBALS ['http _ RAW_POST_DATA ']; // php. ini is required.
If (empty ($ content )){
$ Content = file_get_contents ('php: // input'); // You do not need to set php. ini. the memory pressure is low.
}
$ Ret = file_put_contents ($ file, $ content, true );
Return $ ret;
}

Binary_to_file ('photo/test.png ');

Pipeline/** binary stream generation file * $ _ POST cannot interpret binary streams. you need to use $ GLOBALS ['http _ RAW_POST_DATA '] or php: // input * $ GLOBALS ['...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.