Directory tree listing [closed]
質問
Hi i am looking for script witch lists directory's from ftp and read's all files from the listed folder..Is there something that can help me?
- > //open the dir
$sub = ($_GET['dir']); $path = 'store/'.$diro.'/'; $path = $path . "$sub"; $dh = opendir($path); $i=1; while (($file = readdir($dh)) !== false) { if($file != "." && $file != "..") { if (substr($file, -4, -3) =="."){ echo "$i. $file
"; }else{
echo "$i. $file"; } $i++; } } closedir($dh);
解決
I did a quick Google, and there a MILLIONS of responses to this question.
The fourth result is a complete code sample.
http://www.phpreg.com/index.php?option=com_content&task=view&id=158&Itemid=28
Something like....
<?php
$connect = ftp_connect("ftp.hostname.com");
$result = ftp_login($connect, "username", "password");
$a = ftp_nlist($connect, "code22");
foreach($a as $value){
echo $value, "<BR>";
}
?>