php无限遍历目录示例_php实例

WBOY
Release: 2016-05-17 08:48:58
Original
957 people have browsed it

最近在能php目录操作,搞了一个目录无限遍历:

使用的函数有:

isset()判断某个变量是否定义

chdir() 将当前目录改变为指定的目录。

opendir() 打开目录。

readdir()读取目录。

getcwd()。获取当前目录。

还用到了for  if  GET传值 大概就这些东东:

下面是代码:

复制代码 代码如下:

if(isset($_GET['id']))
{

    $s=$_GET['id'];
        chdir($s);
    }
echo '当前在'.getcwd(),'
';
$a=opendir('.');
while($c=readdir($a))
{
    if(is_dir($c))
    {
        $w=getcwd().'\\'.$c;
    echo $c."打开
";
    }
    else
    {
            echo $c.'
';
     }

 }

?>


大家如果有什么建议可以提出来!!谢谢!!
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template