📄 00000023.htm
字号:
<HTML><HEAD> <TITLE>BBS水木清华站∶精华区</TITLE></HEAD><BODY><CENTER><H1>BBS水木清华站∶精华区</H1></CENTER>发信人: thinkin (强强), 信区: Linux <BR>标 题: File lister <BR>发信站: BBS 水木清华站 (Thu Feb 17 11:04:15 2000) <BR> <BR><? <BR>/* <BR>This script read the filenames from a specified directory and returns them i <BR>n an array. <BR>The number of filenames is also returned. <BR>Copyleft(L) 1999 Eric Persson, <A HREF="mailto:eric@persson.tm,">eric@persson.tm,</A> <A HREF="http://www.persson.tm/script">http://www.persson.tm/script</A> <BR>s/ <BR>*/ <BR>Function searchdir($basedir) <BR>{ <BR>global $filelisting, $number; //defines the two variables as global so they <BR> can be accessed from outside the function <BR> unset($filelisting); //kills $filelisting in case it have been used ear <BR>lier in the script <BR> unset($number); //same as above <BR> $handle=opendir($basedir); <BR> while ($file = readdir($handle)) { <BR> if ($file== "." or $file== "..") { <BR> } else { <BR> $filelisting[]= "$basedir$file"; <BR> }; <BR> }; <BR> $number=sizeof($filelisting); //gets the size of the array <BR>}; <BR>searchdir( "./"); //runs the function to search the current directory <BR>echo $filelisting[1]; //echos the second value in the array <BR>echo $number; //echos the size of the array <BR>?> <BR> <BR>-- <BR> <BR>人生到处知何似? <BR> 应似飞鸿踏雪泥。 <BR> 泥上偶然留指爪, <BR> 鸿飞那复计东西! <BR> <BR> <BR>※ 来源:·BBS 水木清华站 smth.org·[FROM: 162.105.37.191] <BR><CENTER><H1>BBS水木清华站∶精华区</H1></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -