瀏覽代碼

Add "setDownloadHeaders" helper function

Alan Lam 8 年之前
父節點
當前提交
96455cb4b8
共有 1 個文件被更改,包括 6 次插入 和 0 次删除
  1. 6 0
      engine/http.php

+ 6 - 0
engine/http.php

@@ -32,6 +32,12 @@ class HTTP {
 		return $result;
 	}
 
+	public static function setDownloadHeaders($filename) {
+		header("Content-Disposition: attachment; filename=\"$filename\"");
+		header("Cache-Control: private, max-age=0, must-revalidate");
+		header("Pragma: public");
+	}
+
 	public static function getDateFromFields($prefix = "") {
 		$date = false;