php 檔案下載

weixin_34120274發表於2014-08-01
<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;
                }


?>

 

相關文章