最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php readfile 函数
时间:2022-07-02 09:57:40 编辑:袖梨 来源:一聚教程网
readfile
( PHP 4中, PHP 5中)
readfile -输出一个文件
描述
国际readfile (字符串$文件名[ ,布尔$ use_include_path =虚假[ ,资源$背景] ] )
读取文件并写入它的输出缓冲器。
参数
文件名
该文件被读取。
use_include_path
您可以使用可选的第二个参数设置为TRUE ,如果你想搜索该文件中的include_path中也。
背景
背景流资源。
返回值
返回的字节数读取文件。如果出现错误,虚假,除非返回的功能称为@ readfile ( ) ,错误信息打印。
实例
例如# 1强迫下载使用readfile ( )
$file = 'monkey.gif';
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
?>
相关文章
- 《小小英雄》刀主流派试炼平民通关阵容推荐 06-15
- 《小小英雄》拳主流派试炼平民通关阵容推荐 06-15
- 如何入手FLOKI币?2025OKX交易所零门槛指南 06-15
- 《燕云十六声》三更断罪最新机制详解 06-15
- 《燕云十六声》河西版本武学流派强度榜 06-15
- 《原神》2025年4月幻想真境剧诗攻略 06-15