php目录操作函数之获取目录与文件的类型
代码如下:
<?php $dir = "./"; // Open a known directory, and proceed to read its contents if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { echo "filename: $file : filetype: " . filetype($dir . $file) . "\n"."<br />"; } closedir($dh); } } ?>
输出结果:
代码如下:
filename: . : filetype: dir filename: .. : filetype: dir filename: cms : filetype: dir filename: index.php : filetype: file filename: index.php.bak : filetype: file filename: mvc : filetype: dir filename: shop : filetype: dir filename: shop.rar : filetype: file filename: xampp : filetype: dir
相关推荐
zyyjay 2020-11-09
xuebingnan 2020-11-05
samtrue 2020-11-22
stefan0 2020-11-22
yifangs 2020-10-13
songshijiazuaa 2020-09-24
hebiwtc 2020-09-18
天步 2020-09-17
83911535 2020-11-13
whatsyourname 2020-11-13
zhouyuqi 2020-11-10
Noneyes 2020-11-10
mathchao 2020-10-28
王志龙 2020-10-28
wwwsurfphpseocom 2020-10-28
diskingchuan 2020-10-23
savorTheFlavor 2020-10-23