手机
当前位置:查字典教程网 >编程开发 >php教程 >php 强制下载文件实现代码
php 强制下载文件实现代码
摘要:复制代码代码如下:?

复制代码 代码如下:

<?php

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

}

?>

?

<?php

header("Content-Type: application/force-download");

header("Content-Disposition: attachment; filename=ins.jpg");

readfile("imgs/test_Zoom.jpg");

?>

【php 强制下载文件实现代码】相关文章:

php开发中的页面跳转方法总结

php实现读取和写入tab分割的文件

php中PDO方式实现数据库的增删改查

php生成zip文件类实例

php curl 上传文件代码实例

php的控制语句

我的论坛源代码(二)

PHP4中实现动态代理

PHP实现远程下载文件到本地

用php实现gb2312和unicode间的编码转换

精品推荐
分类导航