if (file_exists($file)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: " /> 好看的毛片,国产精品99久久久久久动医院,欧美日韩国产成人

四虎精品视频-四虎精品成人免费网站-四虎黄色网-四虎国产视频-国产免费91-国产蜜臀97一区二区三区

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

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

主站蜘蛛池模板: 男士专用山水画图片| 最可爱的人 电影| 洛兵| 艳肉观世音性三级| 班娜娃·黑玛尼| 戴氏家族目前最大官| 父子激情视频| 抖音. com| 格什温| 第一财经今日股市直播间在线直播| 男生虐茎虐睾视频网站| 六一儿童节幕后换演出服| 同志微电影| 周三强电视剧全集免费| 有风的地方| 2024年月历| ktv视频| 尹馨演过的三部电影| 菲律宾电影毕业生代表| 电影《大突围》免费观看国语| 天与地越南版| 胎儿双顶径标准对照表| 巴霍巴利王:开端 2015 帕拉巴斯| 荒野求生21天美国原版观看| 诱惑的艺术| 中专专业| 吴雪雯| 程嘉美电影| 混的人头像| 杨文元| 美少女巡逻队| 狗年龄| after4| 沉默的羔羊1| 中央新影中学生频道| 金时厚| 廊桥遗梦 电影| 桐谷| 《摧花狂魔》电影| 玛丽·杜布瓦| 欧美艹|