zoukankan      html  css  js  c++  java
  • Web 在线文件管理器学习笔记与总结(1)初始文件以及获取首层目录信息

    在线文件管理器即使用浏览器管理和操作项目中的目录和文件

    文件相关操作包括:

    1.创建文件

    2.判断文件的权限

    3.文件的大小

    4.文件的创建时间、修改时间、访问时间

    5.查看文件的内容

    6.修改文件的内容

    7.删除文件

    8.重命名文件

    9.复制文件

    10.剪切文件

    11.上传文件

    12.下载文件

    文件夹相关操作:

    1.新建文件夹

    2.判断文件夹的权限

    3.文件夹的大小

    4.文件夹的创建时间、修改时间、访问时间

    5.查看文件夹的内容

    6.重命名文件夹

    7.复制文件夹

    8.剪切文件夹

    9.文件夹的下载

    操作

    1.遍历目录

    a.得到需要管理的目录中的内容,包括文件和目录

    b.通过遍历目录来实现

    目录结构

    file 目录包含需要操作的文件和文件夹;

    images 包含所有的图片;

    cikonss.css 是 bootstrap 项目的一个纯css 实现 icon 的css 文件;

    index.php 主入口;

    dir.func.php 存放所有跟目录相关的操作的函数;

    index.php 初始的(还没有编写任何 php 脚本和 js 脚本)入口文件(只有 html 和 css):

     1 <!DOCTYPE html>
     2 <html>
     3 <head>
     4 <meta charset="UTF-8">
     5 <title>Insert title here</title>
     6 <link rel="stylesheet" href="cikonss.css" />
     7 <style type="text/css">
     8     body,p,div,ul,ol,table,dl,dd,dt{
     9         margin:0;
    10         padding: 0;
    11     }
    12     a{
    13         text-decoration: none;
    14     }
    15     ul,li{
    16         list-style: none;
    17         float: left;
    18     }
    19     #top{
    20         width:100%;
    21         height:48px;
    22         margin:0 auto;
    23         background: #E2E2E2;
    24     }
    25     #navi a{
    26         display: block;
    27         width:48px;
    28         height: 48px;
    29     }
    30     #main{
    31         margin:0 auto;
    32         border:2px solid #ABCDEF;
    33     }
    34     .small{
    35         width:25px;
    36         height:25px;
    37         border:0;
    38 }
    39 </style>
    40 </head>
    41 <body>
    42 <h1>在线文件管理器</h1>
    43 <div id="top">
    44     <ul id="navi">
    45         <li><a href="index.php" title="主目录"><span style="margin-left: 8px; margin-top: 0px; top: 4px;" class="icon icon-small icon-square"><span class="icon-home"></span></span></a></li>
    46         <li><a href="#" title="新建文件" ><span style="margin-left: 8px; margin-top: 0px; top: 4px;" class="icon icon-small icon-square"><span class="icon-file"></span></span></a></li>
    47         <li><a href="#" title="新建文件夹"><span style="margin-left: 8px; margin-top: 0px; top: 4px;" class="icon icon-small icon-square"><span class="icon-folder"></span></span></a></li>
    48         <li><a href="#" title="上传文件"><span style="margin-left: 8px; margin-top: 0px; top: 4px;" class="icon icon-small icon-square"><span class="icon-upload"></span></span></a></li>
    49         <li><a href="#" title="返回上级目录"><span style="margin-left: 8px; margin-top: 0px; top: 4px;" class="icon icon-small icon-square"><span class="icon-arrowLeft"></span></span></a></li>
    50     </ul>
    51 </div>
    52 </body>
    53 </html>

    dir.func.php beta1 读最外层文件内容:

    <?php
    //打开指定目录
    function readDirectory($path){
        $handle = opendir($path);
        while(($item = readdir($handle)) !== false){
            //.当前目录和..上级目录
            if($item != '.' && $item != '..'){
                if(is_file($path.'/'.$item)){    //文件
                    $arr['file'][] = $item;    //把文件保存至二维数组
                }
                if(is_dir($path.'/'.$item)){    //目录
                    $arr['dir'][] = $item; //把目录保存至二维数组
                }
            }
        }
        closedir($handle);
        return $arr;
    }
  • 相关阅读:
    怎么把视频变小?
    Java使用HtmlUnit抓取js渲染页面
    范仁义css3课程---2、css代码引入方式
    范仁义css3课程---1、认识css样式
    width和max-width和min-width的区别
    CSS的盒子模型
    css选择器,伪类和伪元素的区别
    CSS选择器详解(总结)
    心得体悟帖---总结-191231(看似明悟)
    css3图片卡片效果
  • 原文地址:https://www.cnblogs.com/dee0912/p/4376737.html
Copyright © 2011-2022 走看看