仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 890|回复: 18
打印 上一主题 下一主题

[学习教程] PHP编程:文件清单列表(酷)

[复制链接]
若天明 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-2-4 00:09:08 | 显示全部楼层 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
在学习HTML中我想边学边做是最有效的方式,当然这一方式对于学习PHP同样是最有效的。   [法式言语] PHP

[源码来历] http://px.sklar.com
[功效描写] 该剧本从一个指定目次中读取文件名,以后把这些文件名前往到数组中,还包含文件个数。

源代码以下:

<?
/*
This script read the filenames from a specified directory and returns them in an array.
The number of filenames is also returned.
Copyleft(L) 1999 Eric Persson, eric@persson.tm, http://www.persson.tm/scripts/
*/
Function searchdir($basedir)
{
global $filelisting, $number; //defines the two variables as global so they can be accessed from outside the function
unset($filelisting); //kills $filelisting in case it have been used earlier in the script
unset($number); //same as above
$handle=opendir($basedir);
while ($file = readdir($handle)) {
if ($file=="." or $file=="..") {
}
else {
$filelisting[]="$basedir$file";
};
};
$number=sizeof($filelisting); //gets the size of the array
};
searchdir("./"); //runs the function to search the current directory
echo $filelisting[1]; //echos the second value in the array
echo $number; //echos the size of the array
?>
  一下弹出N多页面!很明显,你的留言本并没有做好安全防范,被人用JS代码小小的耍了一下,我很同情你这个时候的感受,但是没有别的办法了,继续努力吧!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-6-9 14:45

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表