Blogger Information
Blog 48
fans 0
comment 0
visits 36370
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
文件目录遍历 2018.08.28作业
雨天的博客
Original
746 people have browsed it

实例

<?php
/**
 * 传统的过程函数 opendir() readdir() closedir()
 * 目录扫描器 scandir()
 */
 $file = opendir('../827') or dir('打开失败');
 while(false!=($files=readdir($file)))
 {
     if($files!='.' && $files!='..')
     {
         echo nl2br($files."\n");
     }
 }
 echo '<hr>';
//目录扫描器
$f = scandir('../828') or dir('打开失败');
foreach ($f as $files)
{
    if($files!='.' && $files!='..')
    {
        echo nl2br($files."\n");
    }
}
 closedir($file);

运行实例 »

点击 "运行实例" 按钮查看在线实例

运行结果:

QQ截图20180829164604.png

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!