Warning: session_start() [function.session-start]: open(/home/mybwtech/public_html/article/tmp/sess_51b81b5e68d962a63a4c7f7512323d8e, O_RDWR) failed: No such file or directory (2) in /home/mybwtech/public_html/article/global.php on line 3

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/mybwtech/public_html/article/global.php:3) in /home/mybwtech/public_html/article/global.php on line 3

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/mybwtech/public_html/article/global.php:3) in /home/mybwtech/public_html/article/global.php on line 3
用php实现文件清单列表 - 龙舞天翔资源共享
我的控制台 会员登陆 免费注册 最后更新 高级搜索 返回首页 我要投稿 退出登陆 龙舞论坛
当前在线: 0
 
站内搜索
Google
www.bwtech.net

德州扑克资料
投资透视
网站优化推广&SEO
网站设计
网络编程语言与开发
课件开发制作
网络文学
小资生活
数码摄影
财经-经营管理
其他杂项
龙舞天翔资源共享 / 网络编程语言与开发 / PHP语言技术 / 用php实现文件清单列表
用php实现文件清单列表
2005-06-16       http://px.sklar.com    点击: 1593
用php实现文件清单列表

[程序语言] PHP

[功能描述] 该脚本从一个指定目录中读取文件名,之后把这些文件名返回到数组中,还包括文件个数。

源代码如下:

<?
/*
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
?>
责任编辑: 龙舞天翔

相关文章
关于phpArticle后台无法登陆的问题 - 02-24 10:23 am - 点击: 481
php 实现无限分类 - 07-14 01:25 am - 点击: 1496
ASP,PHP,JSP各自的优点和缺点 - 03-05 10:47 pm - 点击: 2068
提升PHP速度全攻略 - 02-09 04:42 am - 点击: 1379
PHP:路在何方? - 02-09 04:37 am - 点击: 1424
PHP编码规范 - 02-09 04:33 am - 点击: 1266
PHP简介 - 02-09 04:31 am - 点击: 1679
回顾 PHP 5.0 的变化与PHP 6.0 展望 - 02-08 10:23 pm - 点击: 1447
phpArticle 首页分类调用较完美解决方案 - 12-14 05:07 am - 点击: 1577
phpArticle防止图片盗链的方法 - 12-11 11:04 am - 点击: 1615

发表评论 查看评论 加入收藏 Email给朋友 打印本文
如果你想对该文章评分, 请先登陆, 如果你仍未注册,请点击注册链接注册成为本站会员.
平均得分 0, 共 0 人评分
1 2 3 4 5 6 7 8 9 10
Copyright © 2002 -2003 龙舞天翔资源共享
All rights reserved.
Powered by: phpArticle Version 2.0

Warning: Unknown: open(/home/mybwtech/public_html/article/tmp/sess_51b81b5e68d962a63a4c7f7512323d8e, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/home/mybwtech/public_html/article/tmp) in Unknown on line 0