[請益] 壓縮檔

看板PHP作者 (知足常樂)時間18年前 (2008/01/27 16:13), 編輯推噓2(203)
留言5則, 2人參與, 最新討論串1/2 (看更多)
請問一下 我要把檔案打包變成壓縮檔下載 $file = "D:\\www\\"; //檔案路徑 system("tar -zpcf hw1.tgz view_car.c view.c",$output);  //把view_car.c view.c變成壓縮檔 if(!$output=false){ header('Content-Description: File Transfer'); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=hw1.tgz"); readfile($file); } 是可以下載但是壓縮檔裡是空的,沒有檔案。 請問有人知道為什麼會這樣嗎? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.160.61.127

01/27 16:56, , 1F
因為$file還是資料夾?readfile($file.'hw1.tgz');呢
01/27 16:56, 1F

01/27 17:08, , 2F
還是不行耶,因為$file路徑裡沒有hw1.tgz這個檔
01/27 17:08, 2F

01/27 17:12, , 3F
壓縮完的檔好像沒有存在電腦裡耶.....
01/27 17:12, 3F

01/27 17:13, , 4F
這樣是沒有成功壓縮嗎?
01/27 17:13, 4F

01/27 23:44, , 5F
but 你windows下有tar這程式嗎..
01/27 23:44, 5F
文章代碼(AID): #17d3r3ou (PHP)
討論串 (同標題文章)
文章代碼(AID): #17d3r3ou (PHP)