Heim  >  Artikel  >  php教程  >  fpassthru -输出所有剩余的数据文件指针

fpassthru -输出所有剩余的数据文件指针

WBOY
WBOYOriginal
2016-06-13 11:17:25885Durchsuche

fpassthru -输出所有剩余的数据文件指针  

fpassthru
( PHP 4中, PHP 5中)

fpassthru -输出所有剩余的数据文件指针

描述
国际fpassthru (资源$处理)
读取EOF分析的特定文件指针从当前的位置和结果写入到输出缓冲区。

您可能需要请倒带( )重置文件指针的开头的文件如果您已经写入数据文件。

如果您只想转储文件内容的输出缓冲区,而不首先修改或寻求特定抵消,您可能会想要使用readfile ( ) ,从而节省您fopen ( )函数的调用。

参数

把柄
文件指针必须有效,必须指向一个文件成功打开fopen ( )或者fsockopen ( ) (和尚未关闭fclose ( ) ) 。


返回值
如果出现错误, fpassthru ( )返回FALSE 。否则, fpassthru ( )返回的字符数读取处理和通过输出。

实例

例如# 1使用fpassthru ( )与二进制文件

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

?>


Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel:php fgetcsv 函数Nächster Artikel:php rawurlencode 与 rawurldecode教程