作者prelight (0rz)
看板PHP
标题Re: [请益] 如何隐藏href的id和pw
时间Sat Oct 14 06:32:28 2006
以下是我的程式 但是还是会有
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)
1F:推 qrtt1:请问是什麽理由不能使用ftp function @@? 10/14 06:45
2F:→ prelight:没有阿 就是想试试看这样行不行 有人可以吗orz 10/14 14:38
3F:→ prelight:我一直跑出550错误 可是路径应该对阿 10/14 14:38
4F:→ prelight:请问一下国外php论坛比较好的有哪些阿 我想去那边问问 10/14 14:43
5F:推 taiwancat:对不起...这里的不够好 我对不起大家╭(─╴╴─)╮ 10/14 17:56
6F:推 qrtt1:550 是没有使用权限。猜测可能无法直接建立连线而你的 10/14 20:54
7F:→ qrtt1:fopen又不会自动转成PASV模式导致的吧 10/14 20:55
8F:→ qrtt1:不过怎麽看都觉得奇怪就是了。ftp明明要二条线路去达成实作 10/14 20:56
9F:→ qrtt1:想用一个fopen搞定,实在是.... 10/14 20:56
10F:→ taiwancat:ftp是对话式的通讯协定...这样搞可以? 10/14 21:18