if (file_exists($file)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: " /> 亚洲成a人片在线观看中,91亚洲欧美,欧美孕妇乱大交xxxxx

一区二区久久-一区二区三区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下載文件的代碼示例,轉載需保留來源!

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

主站蜘蛛池模板: 中文字幕免费视频精品一 | 性视频一区| 午夜精品在线视频 | 免费永久在线观看污污的网站 | 国产精品一区二区久久 | 青青草国产青春综合久久 | 伊人网视频在线 | 国产二级毛片 | 老司机日日摸夜夜摸精品影院 | 337p欧洲日本大胆艺术 | 精品久久久久久久免费加勒比 | 久久国产综合 | 日日噜噜夜夜狠狠tv视频免费 | 亚洲精品欧美 | 精品久久久久久中文字幕 | 真实国产乱子伦在线观看 | 亚洲第一页视频 | 久插视频| 国产精品日韩欧美在线第3页 | 国产在线激情视频 | 激情五月在线 | 国产精品视频播放 | 伊人网综合在线视频 | 九九51精品国产免费看 | 精品国产自在现线久久 | 欧美成人三级网站 | 国产a级精品特黄毛片 | 青青草国产免费国产是公开 | 亚洲精品私拍国产福利在线 | 97人人模人人爽视频一区二区 | 婷婷亚洲五月 | 99久久精品国产麻豆 | 日韩精品视频免费网址 | 亚洲精品免费在线视频 | 国产成人精品久久一区二区小说 | 国产成人小视频在线观看 | 成人激情免费视频 | 911亚洲精品国内自产 | 韩国美女一级毛片 | 国产美女在线播放 | 婷婷在线视频国产综合 |