最新videosfree性另类,秋霞电影院午夜伦,荡乳尤物h窑子开张了 http://www.aucma-it.com/blog 中山php|最優(yōu)網(wǎng)絡(luò) Mon, 13 May 2013 04:56:43 +0000 en hourly 1 http://wordpress.org/?v=3.1.4 php強(qiáng)制下載文件,避免文件或者圖片直接在瀏覽器打開 http://www.aucma-it.com/blog/view-194.html http://www.aucma-it.com/blog/view-194.html#comments Thu, 25 Aug 2011 07:08:29 +0000 lin http://www.aucma-it.com/blog/?p=194 以下代碼是FLEAPHP框架自帶的文件下載助手類

/**
* FLEA_Helper_SendFile 類用于向瀏覽器發(fā)送文件
*
* 利用 FLEA_Helper_SendFile,應(yīng)用程序可以將重要的文件保存在
* 瀏覽器無法訪問的位置。然后通過程序?qū)⑽募?nèi)容發(fā)送給瀏覽器。
*
* @package Core
* @author 起源科技 (www.qeeyuan.com)
* @version 1.0
*/
class FLEA_Helper_SendFile
{
/**
* 向瀏覽器發(fā)送文件內(nèi)容
*
* @param string $serverPath 文件在服務(wù)器上的路徑(絕對或者相對路徑)
* @param string $filename 發(fā)送給瀏覽器的文件名(盡可能不要使用中文)
* @param string $mimeType 指示文件類型
*/
function sendFile($serverPath, $filename, $mimeType = 'application/octet-stream')
{
header("Content-Type: {$mimeType}");
$filename = '"' . htmlspecialchars($filename) . '"';
$filesize = filesize($serverPath);
$charset = FLEA::getAppInf('responseCharset');//根據(jù)實際文件編碼類型,如utf-8,gbk
header("Content-Disposition: attachment; filename={$filename}; charset={$charset}");
header('Pragma: cache');
header('Cache-Control: public, must-revalidate, max-age=0');
header("Content-Length: {$filesize}");
readfile($serverPath);
exit;
}
}

]]>
http://www.aucma-it.com/blog/view-194.html/feed 10
主站蜘蛛池模板: 石渠县| 永顺县| 庆城县| 晋中市| 西乡县| 万山特区| 丰原市| 昌邑市| 怀远县| 安平县| 荆门市| 红桥区| 武功县| 昌乐县| 闻喜县| 九龙坡区| 天全县| 改则县| 洛川县| 北安市| 南充市| 东台市| 兴业县| 临泉县| 沭阳县| 长汀县| 惠水县| 板桥市| 义乌市| 利川市| 西畴县| 新建县| 沭阳县| 固安县| 含山县| 和顺县| 丘北县| 商河县| 武陟县| 宁津县| 登封市|