<?php
$dir = "/tmp/";
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
print "filename: $file : filetype: " . filetype($dir . $file) . "\n";
}
closedir($dh);
}
}
?>
$dir = "/tmp/";
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
print "filename: $file : filetype: " . filetype($dir . $file) . "\n";
}
closedir($dh);
}
}
?>
解决方案 »
- 关于怎样现实注册用户过后自动登陆的功能
- 在北京,php程序员一行代码多少钱,有没有市场价? jsp的呢?
- 如何在php中执行多条sql语句
- PHP添加域名的问题?
- 我想问下php结合linux系统命令可以获取磁盘分区的格式吗
- 上传图片文件
- 保护网页内容防止复制、另存、拷屏、打印等
- 奇怪的问题
- php如何连接mysql?
- 在一个asp的页面里,多次调用一个php程序的页面刷新的问题,送100分急救!!!
- 在Red Hat Linux 9+Apache2.0.48+php4.3.4+ZendOptimizer2.1.0b MySQL5.0.0-0+Tomcat5.0.16+ j2sdk1.4.2.03整合
- “异域名 存取 session”的问题,一个巨迷惑人的问题。(大家都来挑战这个问题)
function get_dir_and_file( $dir )
{
static data = array();
$file = '';
$handle = '';
$full_file_name = ''; if ( $handle = opendir( $dir ) )
{
while( false != ( $file = readdir( $handle ) ) )
{
if ( $file != '.' && $file != '..' )
{
$full_file_name = $dir . '/' . $file;
$data[] = $full_file_name; if ( filetype( $full_file_name ) == 'dir' )
get_dir_and_file( $full_file_name );
}
} closedir( $handle );
}
}
我对PHP不太熟,请再次赐教!再次感谢
{
static data = array();
$file = '';
$handle = '';
$full_file_name = ''; if ( $handle = opendir( $dir ) )
{
while( false != ( $file = readdir( $handle ) ) )
{
if ( $file != '.' && $file != '..' )
{
$full_file_name = $dir . '/' . $file;
$data[] = $full_file_name; if ( filetype( $full_file_name ) == 'dir' )
get_dir_and_file( $full_file_name );
}
} closedir( $handle );
} //最后
return $data;
}