Home > Backend Development > PHP Tutorial > fpassthru - Output all remaining data file pointers_PHP Tutorial

fpassthru - Output all remaining data file pointers_PHP Tutorial

WBOY
Release: 2016-07-20 11:01:10
Original
1138 people have browsed it

fpassthru - prints all remaining data file pointers ​

fpassthru
(PHP 4, PHP 5)

fpassthru - Output all remaining data file pointers

Description
international fpassthru (resource $ handle)
Reads the EOF analysis's specific file pointer from the current location and writes the results to the output buffer.

You may need to rewind() the file pointer to the beginning of the file if you have written data to the file.

If you just want to dump the file contents to the output buffer without first modifying or seeking a specific offset, you may want to use readfile(), thus saving you a call to the fopen() function.

Parameters

Handle
The file pointer must be valid and must point to a file successfully opened by fopen() or fsockopen() (and not yet closed by fclose()).


Return value
If an error occurs, fpassthru() returns FALSE. Otherwise, fpassthru() returns the number of characters read processed and passed through the output.

Example

Example #1 Using fpassthru() with binaries

// 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;

?>


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445466.htmlTechArticlefpassthru - Output all remaining data file pointer fpassthru (PHP 4, PHP 5) fpassthru - Output all remaining data Data file pointer describing international fpassthru (resource $ handle)...
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