Fpassthru-output all remaining data file pointers

Source: Internet
Author: User

Fpassthru-output all remaining data file pointers

Fpassthru
(PHP 4 and PHP 5)

Fpassthru-output all remaining data file pointers

Description
International fpassthru (resource $ processing)
The specific file pointer that reads the EOF analysis is written from the current position and result to the output buffer.

You may need to reset the file starting with the file pointer with () If you have written data files.

If you only want to dump the output buffer of the file content without first modifying or seeking for a specific offset, you may want to use readfile () to save your fopen () function calls.

Parameters

Handle
The file pointer must be valid and must point to a file that successfully opens fopen () or fsockopen () (and has not closed fclose ()).


Return Value
If an error occurs, fpassthru () returns FALSE. Otherwise, the number of characters returned by fpassthru () is read and output.

Instance

For example, #1 uses fpassthru () and binary files

// Open the file in a binary mode
$ Name = './img/OK .png ';
$ Fp = fopen ($ name, 'rb ');

// Send the right headers
Header ("Content-Type: image/png ");
Header ("Content-Length:". filesize ($ name ));

// Dump the picture and stop the script
Fpassthru ($ fp );
Exit;

?>


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.