File manager basic display page

The verification code function mentioned in the previous chapter cannot see the function code for changing one as follows:

    Title 
用户名:
密码:
验证码:看不清,换一张

Rendering display:

微信图片_20180301111913.png

Click to display:

微信图片_20180301111920.png

The above are the questions left in the last section of the previous chapter. Next, read this section content, this section is to make a similar windows file manager

Design ideas:

First find Current directory, determine whether the current directory is a file or a directory. You can view information about all files and directories in the current directory through the following code

微信图片_20180301155316.png

The specific code is as follows:

array(),'file'=>array()); //循环遍历文件列表 while(false!==($filename=readdir($handle))){ //排除当前目录和父级目录 if($filename!='.' && $filename!='..'){ //处理文件路径和文件名 $filepath="$path/$filename"; //根据路径获取文件类型 $filetype=filetype($filepath); //如果既不是文件也不是目录,则跳过 if(!in_array($filetype,array('file','dir'))){ continue; } //将文件信息保存到数组中 $list[$filetype][]=array( //保存文件名和路劲 'filename'=>$filename, 'filepath'=>$filepath, //保存各种属性 'filesize'=>round(filesize($filepath)/1024), 'filemtime'=>date('Y/m/d H:i:s',filemtime($filepath)), ); } } //关闭文件句柄 closedir($handle); return $list; $path="."; $file_list=getFileList($path); echo "
"; print_r($file_list); echo "
";

The directory structure is as follows:

微信图片_20180301155556.png

The print result is as follows:

微信图片_20180301153739.png


Then set up the html page according to the windows directory folder, and traverse the file_list printed above.

filemanager_html.php code As follows:

    文件管理器 
名称修改日期大小操作
- 打开
KB 重命名复制删除


##Running result display:

微信图片_20180301160412.png


So, how to perform specific operations of opening, renaming, copying and deleting files and directories? (This will be explained in the next section)

Continuing Learning
||
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!