枚举目录下文件

<?php  
 
    //获取当前文件所在的绝对目录
    $dir =  dirname(__FILE__);
 
    echo $dir;
    //扫描文件夹
    $file = scandir($dir);
    //显示
function listFiles( $from = '.')
{
    if(! is_dir($from))
        return false;
 
    $files = array();
    $dirs = array( $from);
    while( NULL !== ($dir = array_pop( $dirs)))
    {
        if( $dh = opendir($dir))
        {
            while( false !== ($file = readdir($dh)))
            {
                if( $file == '.' || $file == '..')
                    continue;
                $path = $dir . '/' . $file;
                if( is_dir($path))
                    $dirs[] = $path;
                else
                    $files[] = $path;
            }
            closedir($dh);
        }
    }
    return $files;
}
 
$files = listFiles($dir);
 
 
foreach ($files as $fp) {
    $t = str_replace($dir, "", iconv("GB2312","utf-8",$fp));
 
    echo '<div><a href="http://www.tianlunvip.com/jscode/'.$t.'">'.$t.'</a></div>';
}
 
 
    exit();
?>
 
<!DOCTYPE html>
<html lang="zh">
    <head>
        <meta charset="utf-8">
        <title>JavaScript 网页特效</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
 
        <!-- The main CSS file -->
        <link href="css/main.css" rel="stylesheet">
 
        <!-- CSS file for your custom modifications -->
        <link href="css/custom.css" rel="stylesheet">
 
        <link rel="shortcut icon" href="images/favicon.ico">
 
        <!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
        <!--[if lt IE 9]>
          <script src="js/html5shiv.js"></script>
        <![endif]-->
    </head>
 
 
    <!-- Scrollspy set in the body -->
    <body id="home" data-spy="scroll" data-target=".main-nav" data-offset="73">
 
    <!--/////////////////////////////////////// NAVIGATION BAR ////////////////////////////////////////-->
 
    <section id="header">
 
        <nav class="navbar navbar-fixed-top" role="navigation">
 
            <div class="navbar-inner">
                <div class="container">
 
                    <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target="#navigation"></button>
 
                    <!-- Logo goes here - replace the image with yours -->
                    <a href="http://www.tianlunvip.com" class="navbar-brand"><img src="images/logo.png" class="logo-img img-responsive" alt="TL" title="TL"></a>
 
 
                    <div class="collapse navbar-collapse main-nav" id="navigation">
 
 
                        <ul class="nav pull-right">
 
                            <!-- Menu items go here -->
                            <li class="active hidden"><a href="http://www.tianlunvip.com">主页</a></li>
                            <!-- If you want sub-menu items, do them like this
                            <li>
                                <ul>
                                  <li><a href="#">Item 1</a></li>
                                  <li><a href="#">Item 2</a></li>
                                </ul>
                            </li> 
                            You just need to delete these comment lines -->
                        </ul>
 
                    </div><!-- /nav-collapse -->
                </div><!-- /container -->
            </div><!-- /navbar-inner -->
        </nav>
 
    </section>
 
    <!--//////////////////////////////////////// end NAVIGATION BAR ////////////////////////////////////////-->
 
 
    <!--/////////////////////////////////////// GALLERY SECTION ////////////////////////////////////////-->
 
    <section id="gallery">
 
        <div class="container">
 
             <header>
                <h1>JavaScript</h1>
                <p class="lead">Here We Are Here We Are Here We Are Here We Are</p>
            </header>
 
            <div id="gallery-items">
 
                <div class="col-lg-3 col-md-4 col-xs-6 gallery-item gallery-popup all kittens">
                    <iframe src="/jscode/canvas/waves-1.html" width="100%" height="250" scrolling="yes"></iframe>
                </div>
 
                <div class="col-lg-3 col-md-4 col-xs-6 gallery-item gallery-popup all kittens">
                    <iframe src="/jscode/canvas/waves-2.html" width="100%" height="250" scrolling="yes"></iframe>  
                </div>
 
                <div class="col-lg-3 col-md-4 col-xs-6 gallery-item gallery-popup all kittens">
                    <iframe src="/jscode/canvas/waves-3.html" width="100%" height="250" scrolling="yes"></iframe>  
                </div>
 
                <div class="col-lg-3 col-md-4 col-xs-6 gallery-item gallery-popup all kittens">
                    <iframe src="/jscode/canvas/waves-4.html" width="100%" height="250" scrolling="yes"></iframe>   
                </div>
 
                <div class="col-lg-3 col-md-4 col-xs-6 gallery-item gallery-popup all kittens">
                    <iframe src="/jscode/canvas/waves-5.html" width="100%" height="250" scrolling="yes"></iframe>  
                </div>
 
 
 
 
                <div class="col-lg-3 col-md-4 col-xs-6 gallery-item gallery-popup all kittens">
                    <figure>
                        <a href="乱画线之心.html" class="zoom"><iframe src="/jscode/canvas/waves-5.html" width="100%" height="250" scrolling="yes"></iframe>  </a>
                        <div class="item-hover">
                            <a href="/jscode/canvas/waves-5.html">乱画线之心</a> 
                        </div>   
                    </figure>    
                </div>
 
 
            </div>
 
        </div><!-- /container -->
 
    </section>
 
    <!--/////////////////////////////////////// end GALLERY SECTION ////////////////////////////////////////-->
 
 
    <!--//////////////////////////////////////// FOOTER SECTION ////////////////////////////////////////-->
    <section id="footer">
        <div class="bottom-menu-inverse">
 
            <div class="container">
 
                <div class="row">
                    <div class="col-md-6">
                        <p> <a href="" title="网页模板" target="_blank"></a>.</p>
                    </div>
 
                    <div class="col-md-6 social">
                        <ul class="bottom-icons">
                            <li>
                              <a href="#" class="fui-facebook"></a>
                            </li>
                             <li>
                              <a href="#" class="fui-twitter"></a>
                            </li>
                             <li>
                              <a href="#" class="fui-pinterest"></a>
                            </li>
                             <li>
                              <a href="#" class="fui-googleplus"></a>
                            </li>
                             <li>
                              <a href="#" class="fui-dribbble"></a>
                            </li>
                             <li>
                              <a href="#" class="fui-vimeo"></a>
                            </li>
                          </ul>                      
                    </div>
                </div>
 
            </div><!-- /row -->
        </div><!-- /container -->
 
    </section>
 
    <!--//////////////////////////////////////// end FOOTER SECTION ////////////////////////////////////////-->
 
 
 
    <!--//////////////////////////////////////// JAVASCRIPT LOAD ////////////////////////////////////////-->
 
    <!-- Feel free to remove the scripts you are not going to use -->
    <script src="js/jquery-1.8.3.min.js"></script>
    <script src="js/jquery-ui-1.10.3.custom.min.js"></script>
    <script src="js/jquery.ui.touch-punch.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/jquery.isotope.min.js"></script>
    <script src="js/jquery.magnific-popup.js"></script>
    <script src="js/jquery.fitvids.min.js"></script>
    <script src="assets/twitter/jquery.tweet.js"></script>
    <script src="js/bootstrap-select.js"></script>
    <script src="js/bootstrap-switch.js"></script>
    <script src="js/flatui-checkbox.js"></script>
    <script src="js/flatui-radio.js"></script>
    <script src="js/jquery.tagsinput.js"></script>
    <script src="js/jquery.placeholder.js"></script>
    <script src="js/custom.js"></script>
 
    <!--//////////////////////////////////////// end JAVASCRIPT LOAD ////////////////////////////////////////-->
 
  </body>
</html>
赞(0) 打赏
取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

    暂无评论...