2009-06-12 66 views
6

我正在嘗試製作一個在線kickstart配置文件的創建者。在服務器上創建文件後,如何讓下載對話框彈出以便用戶可以下載它?用PHP打開下載對話框

回答

15

內容處理標頭..

// We'll be outputting a PDF 
header('Content-type: application/pdf'); 
// It will be called downloaded.pdf 
header('Content-Disposition: attachment; filename="downloaded.pdf"'); 
// The PDF source is in original.pdf 
readfile('original.pdf'); 

http://au2.php.net/manual/en/function.header.php