Re: [請益] 如何隱藏href的id和pw
以下是我的程式 但是還是會有
failed to open stream: FTP server reports 550 No such file or directory
這個錯誤在 ...但是我把$redir貼到網址列卻正確的可以下載檔案
我這樣寫有錯嗎@@?
<?php
$redir="ftp://id:pw@ip/filename";
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Disposition: attachment;filename=\"$filename\"");
header("Content-Transfer-Encoding: binary");
readfile_chunked2($redir);
function readfile_chunked2($filename) {
$chunksize = 1*(1024*1024); // how many bytes per chunk
$buffer = '';
$handle = fopen($filename, 'rb');
if ($handle === false) {
return false;
}
while (!feof($handle)) {
$buffer = fread($handle, $chunksize);
print $buffer;
}
return fclose($handle);
}
?>
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.170.133.31
※ 編輯: prelight 來自: 218.170.133.31 (10/14 06:33)
推
10/14 06:45, , 1F
10/14 06:45, 1F
→
10/14 14:38, , 2F
10/14 14:38, 2F
→
10/14 14:38, , 3F
10/14 14:38, 3F
→
10/14 14:43, , 4F
10/14 14:43, 4F
推
10/14 17:56, , 5F
10/14 17:56, 5F
推
10/14 20:54, , 6F
10/14 20:54, 6F
→
10/14 20:55, , 7F
10/14 20:55, 7F
→
10/14 20:56, , 8F
10/14 20:56, 8F
→
10/14 20:56, , 9F
10/14 20:56, 9F
→
10/14 21:18, , 10F
10/14 21:18, 10F
討論串 (同標題文章)
完整討論串 (本文為第 3 之 3 篇):