您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php readfile 函数_PHP教程

2024/4/1 9:06:17发布33次查看
php readfile 函数 
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;
}
?>
http://www.bkjia.com/phpjc/445475.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/445475.htmltecharticlephp readfile 函数 readfile ( php 4中, php 5中) readfile -输出一个文件 描述 国际readfile (字符串$文件名[ ,布尔$ use_include_path =虚假[ ,资源$背景...
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product