if (file_exists($file)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: " /> a一级毛片,在线播放一区二区三区,精品一区二区三区高清免费观看

一区二区久久-一区二区三区www-一区二区三区久久-一区二区三区久久精品-麻豆国产一区二区在线观看-麻豆国产视频

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;
}
?>

以上代碼是下載代碼
接下來貼一段在線預覽pdf文件的代碼
復制代碼 代碼如下:
<?php
public function fddAction()
{
// get attachment location
$attachment_location = $_SERVER["DOCUMENT_ROOT"] . "/pdf/fdd/sample.pdf";

if (file_exists($attachment_location)) {
// attachment exists

// send open pdf dialog to user
header('Cache-Control: public'); // needed for i.e.
header('Content-Type: application/pdf');
header('Content-Disposition: inline; filename="sample.pdf"');
readfile($attachment_location);
die(); // stop execution of further script because we are only outputting the pdf

} else {
die('Error: File not found.');
}
}
?>

php技術php下載文件的代碼示例,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 99视频国产精品 | 91短视频在线观看免费最新91 | 黄色免费观看视频网站 | 久久国产成人亚洲精品影院老金 | 欧美成人午夜视频免看 | 亚洲一区在线免费观看 | 欧美色成人| 国产在线拍 | 欧美又黄又嫩大片a级 | 国内精品小视频福利网址 | 亚洲一区二区三区影院 | 国产精品视屏 | www.四虎在线观看 | 免费a资源 | 九九51精品国产免费看 | 黄网在线观看网址入口 | 婷婷综合激情 | 免费真实播放国产乱子伦 | 婷婷六月久久综合丁香可观看 | 91福利刘玥国产在线观看 | 一级毛片免费不卡 | 亚洲欧美日韩精品香蕉 | 亚洲综合激情六月婷婷在线观看 | 四虎精品久久久久影院 | 久久精品中文字幕极品 | 在线成人 | 一区在线观看 | 国产小视频你懂的 | 色呦呦免费 | 野外一男一女一级毛片 | 亚洲激情另类 | 四虎影视永久在线精品免费播放 | 亚洲精品美女久久久久网站 | www.夜夜操| 亚洲欧美国产日产综合不卡 | 玖玖视频精品 | 高清一区高清二区视频 | 一区二区三区在线看 | 婷婷综合在线 | 中文字幕日本不卡一二三区 | 久草国产精品 |