Home Backend Development PHP Tutorial How does PHP realize the functional operation of network disk and compressed package?

How does PHP realize the functional operation of network disk and compressed package?

Sep 28, 2017 am 10:13 AM
php Function compression

The code is as follows:

1. Main page file_zip.php

<!DOCTYPE html>
<html>
 <head>
  <meta charset="UTF-8">
  <title>文件管理</title> 
  <script src="bootstrap/js/jquery-1.11.2.min.js"></script> 
 </head>
 <style>
  *{ margin:0px auto; padding:0px}  #wai{ width:800px;}
  .list{ width:50%; height:35px; background-color:#09F; margin-top:2px; color:white; font-weight:bold; text-align:left; line-height:35px; vertical-align:middle; font-size:28px; padding:5px}
  .mulu{ background-color:#FC9}
  .mulu:hover{ cursor:pointer}  
  #prev:hover{ cursor:pointer}
 </style>
 <body>
   <p id="outside">
    <?php    
    session_start();    
    $fname = "/wamp/www";//使$filename的值为根文件夹中www目录下的所有文件夹
    if(!empty($_SESSION["lujing"])){     
    $fname = $_SESSION["lujing"];//把session存储的路径赋值给$fname
     echo "<p id=&#39;prev&#39; class=&#39;list&#39; lj=&#39;{sj}&#39;>返回上一级</p>";
    }               
    ?>
    <p id="inside">
    <?php    
    $sj = dirname($fname);    
    $dir = opendir($fname);    
    $arr = array();//将文件夹与文件合并放入
    $arr1 = array();//放入文件夹
    $arr2 = array();//放入文件
    while($filename = readdir($dir)){//把$fname里面的所有内容遍历出来
     if($filename != "."){      
     $ml = $fname."/".$filename;      
     if(is_dir($ml)){       
     $arr1[ ] = $ml;
      }else{       
      $arr2[ ] = $ml;
      }
     }
    }    
    $arr = array_merge($arr1,$arr2);    
    foreach($arr as $v){    
    $filename = basename($v);     
    if(is_dir($v)){       
    echo "<p lj=&#39;{$ml}&#39; class=&#39;list mulu&#39;>{$filename}</p>";
     }else{      
     echo "<p class=&#39;list&#39;>{$filename}</p>";
     }
    }    
    closedir($dir);      
    ?> 
    </p>
   </p> 
 </body>
 <script>
  $(".mulu").dblclick(function(){   
  var lj = $(this).attr("lj");//取点击内容自己的属性值lj,lj里面存储的是点击的文件夹的目录
   $.ajax({    
    url:"file_zip_chuli.php",
    data:{lj:lj},
    type:"POST",
    dataType:"TEXT",
    success:function(){
     window.location.href = "file_zip.php";
    }
   });
  })
  $("#prev").dblclick(function(){
   Load();
  })//双击事件的方法
  function Load(){   var lj = $(this).attr("lj");
   $.ajax({    
    url:"file_zip_chuli.php",
    data:{lj:lj},
    type:"POST",
    dataType:"TEXT",
    success:function(){
     window.location.href = "file_zip.php";
    }
   });
  } </script>
</html>
Copy after login

2. Main page processing page file_zip_chuli.php
php session_start(); $lj = $_POST["lj"]; $_SESSION["lujing"] = $lj;

The above is the detailed content of How does PHP realize the functional operation of network disk and compressed package?. For more information, please follow other related articles on the PHP Chinese website!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

To work on file upload we are going to use the form helper. Here, is an example for file upload.

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

CakePHP Creating Validators CakePHP Creating Validators Sep 10, 2024 pm 05:26 PM

Validator can be created by adding the following two lines in the controller.

CakePHP Logging CakePHP Logging Sep 10, 2024 pm 05:26 PM

Logging in CakePHP is a very easy task. You just have to use one function. You can log errors, exceptions, user activities, action taken by users, for any background process like cronjob. Logging data in CakePHP is easy. The log() function is provide

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

CakePHP Services CakePHP Services Sep 10, 2024 pm 05:26 PM

This chapter deals with the information about the authentication process available in CakePHP.

See all articles