php 文件下载

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<!-- 文件下载  -->
<?php
$file="D:/wamp/www/ecshop3/images/wap_logo.png";
        if(is_file($file)) {
                    header("Content-Type: application/force-download");
                    header("Content-Disposition: attachment; filename=".basename($file));
                    readfile($file);
                    exit;
                }else{
                    echo "文件不存在!";
                    exit;
                }


?>

 

posted @ 2014-08-01 16:17  龙昊雪  阅读(172)  评论(0编辑  收藏  举报