PHP 文件上载
PHP 文件下载
// $file = "/folder/filename.ext";
function force_download($file) {
??? // 截取文件扩展名
??? $ext = explode(".", $file);
??? switch($ext[sizeof($ext)-1]) {
??????? case 'jar': $mime = "application/java-archive"; break;
??????? case 'zip': $mime = "application/zip"; break;
??????? case 'jpeg': $mime = "image/jpeg"; break;
??????? case 'jpg': $mime = "image/jpg"; break;
??????? case 'jad': $mime = "text/vnd.sun.j2me.app-descriptor"; break;
??????? case "gif": $mime = "image/gif"; break;
??????? case "png": $mime = "image/png"; break;
??????? case "pdf": $mime = "application/pdf"; break;
??????? case "txt": $mime = "text/plain"; break;
??????? case "doc": $mime = "application/msword"; break;
??????? case "ppt": $mime = "application/vnd.ms-powerpoint"; break;
??????? case "wbmp": $mime = "image/vnd.wap.wbmp"; break;
??????? case "wmlc": $mime = "application/vnd.wap.wmlc"; break;
??????? case "mp4s": $mime = "application/mp4"; break;
??????? case "ogg": $mime = "application/ogg"; break;
??????? case "pls": $mime = "application/pls+xml"; break;
??????? case "asf": $mime = "application/vnd.ms-asf"; break;
??????? case "swf": $mime = "application/x-shockwave-flash"; break;
??????? case "mp4": $mime = "video/mp4"; break;
??????? case "m4a": $mime = "audio/mp4"; break;
??????? case "m4p": $mime = "audio/mp4"; break;
??????? case "mp4a": $mime = "audio/mp4"; break;
??????? case "mp3": $mime = "audio/mpeg"; break;
??????? case "m3a": $mime = "audio/mpeg"; break;
??????? case "m2a": $mime = "audio/mpeg"; break;
??????? case "mp2a": $mime = "audio/mpeg"; break;
??????? case "mp2": $mime = "audio/mpeg"; break;
??????? case "mpga": $mime = "audio/mpeg"; break;
??????? case "wav": $mime = "audio/wav"; break;
??????? case "m3u": $mime = "audio/x-mpegurl"; break;
??????? case "bmp": $mime = "image/bmp"; break;
??????? case "ico": $mime = "image/x-icon"; break;
??????? case "3gp": $mime = "video/3gpp"; break;
??????? case "3g2": $mime = "video/3gpp2"; break;
??????? case "mp4v": $mime = "video/mp4"; break;
??????? case "mpg4": $mime = "video/mp4"; break;
??????? case "m2v": $mime = "video/mpeg"; break;
??????? case "m1v": $mime = "video/mpeg"; break;
??????? case "mpe": $mime = "video/mpeg"; break;
??????? case "mpeg": $mime = "video/mpeg"; break;
??????? case "mpg": $mime = "video/mpeg"; break;
??????? case "mov": $mime = "video/quicktime"; break;
??????? case "qt": $mime = "video/quicktime"; break;
??????? case "avi": $mime = "video/x-msvideo"; break;
??????? case "midi": $mime = "audio/midi"; break;
??????? case "mid": $mime = "audio/mid"; break;
??????? case "amr": $mime = "audio/amr"; break;
??????? default: $mime = "application/force-download";
??? }
??? header('Content-Description: File Transfer');
??? header('Content-Type: '.$mime);
??? 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);
}?

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Anker offers both a broad product portfolio, which not only includes various product categories, but also numerous products within each category. Audio products are no exception in this respect, with Anker offering very affordable headsets as well as

TheFiiOCP13cassetteplayerwasannouncedinJanuary.Now,FiiOisexpandingitsportfoliowithtwonewmodels-onewitharedfrontandonewithatransparentfront.Thelatternotonlyperfectlymatchestheretrocharmoftheangulardesign,butalso

The python environment this article relies on is: What is WSGI? WSGI is also called the web server universal gateway interface, and its full name is webservergatewayinterface. It defines a standard for how web servers and web applications should communicate and handle http requests and responses in Python. Note that it is just a protocol, or a specification or standard. You don’t have to follow this standard. Just like the web server we wrote in the previous article. WSGI is also divided into applications and server gateways. Among them, the well-known Flask belongs to applications, and uWSGI and wsgiref belong to server gateways. Personal feeling, WSG

The Klipsch Flexus Core 300 is the top model in the series and is positioned above the already available Flexus Core 200 in the company's soundbar line-up. According to Klipsch, this is the first soundbar in the world whose sound can be adapted to th

Doogeewillsoonbeofferinganewsmartphonewithauniquesellingpointintheformofalargespeakerontheback.Itisclearlynoticeableandvisuallydominatestheback.Themaximumoutputpowerisspecifiedas4watts,andaccordingtothemanufact

Audio refers to the wavelength, frequency and intensity of sound. It is a signal that can be perceived by the human auditory system and is produced by the vibration of an object. Audio usually exists in the form of waveforms that can be recorded, stored, transmitted, and replayed. ,Audio is an important multimedia information that is ,used in various fields. With the development of digital technology, digital audio has become a mainstream technology in the field of modern music production and broadcasting. At the same time, audio processing and digitization are also one of the important directions of modern audio technology. They can improve sound quality, increase sound clarity, and enhance sound expressiveness.

Anker is developing new wireless earbuds, the Soundcore Liberty 4 Pro,which are aimed at users who are willing to dig a little deeper into their pockets for powerful features. There are currently no official details on price or availability, but unco

At IFA 2024, Anker and its Soundcore brand will unveil the new premium Soundcore Space One Pro headphones, positioned above last year's Space One (US$99 on Amazon). The new Space One Pro over-ears are available in two colors for a recommended retail
