代码如下:<?
//====================================================
// 使用范例:
// $download=new download('php,exe,html',false);
// if(!$download->downloadfile($filename))
// {
// echo $download->geterrormsg();
// }
//====================================================
class download{
var $debug=true;
var $errormsg='';
var $Filter=array();
var $filename='';
var $mineType='text/plain';
var $xlq_filetype=array();
function download($fileFilter='',$isdebug=true)
{
$this->setFilter($fileFilter);
$this->setdebug($isdebug);
$this->setfiletype();
}
function setFilter($fileFilter)
{
if(empty($fileFilter)) return ;
$this->Filter=explode(',',strtolower($fileFilter));
}
function setdebug($debug)
{
$this->debug=$debug;
}
function setfilename($filename)
{
$this->filename=$filename;
}
function downloadfile($filename)
{
$this->setfilename($filename);
if($this->filecheck())
{
$fn = array_pop( explode( '/', strtr( $this->filename, '//', '/' ) ) );
header( "Pragma: public" );
header( "Expires: 0" ); // set expiration time
新闻热点
疑难解答