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;

                }





?>

 

你可能感兴趣的:(文件下载)