小白教程
所有教程
关于
Search
172.69.59.164
172.69.59.164
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Func filesystem fpassthru”的源代码
本页内容
上一节:
Func_filesystem_fopen
下一节:
Func_filesystem_fputcsv
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:fpassthru()}}[[Category:PHP Filesystem 文件系统参考手册|34]] = PHP fpassthru() 函数 = [[Category:PHP Filesystem 文件系统参考手册]] == 定义和用法 == fpassthru() 函数从打开文件的当前位置开始读取所有数据,直到文件末尾(EOF),并向输出缓冲写结果。 该函数返回传递的字符数,如果失败则返回 FALSE。 == 语法 == <pre> fpassthru(file) </pre> {| class="table table-striped table-hover" ! 参数 ! 描述 |- | file | 必需。规定要读取的打开文件或资源。 |} == 提示和注释 == '''注释:'''当在 Windows 系统的二进制文件中使用 fpassthru() 函数时,请牢记,必须以二进制的模式打开文件。 '''提示:'''如果您已经向文件写入数据,就必须调用 rewind() 来将文件指针指向文件头。 '''提示:'''如果您只想将文件的内容输出到输出缓冲,而不对它进行修改,请使用 readfile() 函数代替,这样可以省去 fopen() 调用。 == 实例 1 == <sample title="" desc="" lang="php" hererun="1"> <?php $file = fopen("test.txt","r"); // Read first line fgets($file); // Send rest of the file to the output buffer echo fpassthru($file); fclose($file); ?> </sample> 上面的代码将输出: <pre> There are three lines in this file. This is the last line.59 </pre> 59 指示被传递的字符数。 == 实例 2 == 转储 www 服务器的索引页: <sample title="" desc="" lang="php" hererun="1"> <?php $file = fopen("http://www.example.com","r"); fpassthru($file); ?> </sample> [[Category:PHP Filesystem 文件系统参考手册]]
返回至“
Func filesystem fpassthru
”。
上一节:
Func_filesystem_fopen
下一节:
Func_filesystem_fputcsv