zoukankan      html  css  js  c++  java
  • 在线文件管理实例

     1 <!DOCTYPE html>
     2 <html>
     3     <head>
     4         <title>在线文件管理系统</title>
     5         <meta charset='utf-8'/>
     6     </head>
     7     <body>
     8         <center>
     9         <h2>在线文件管理系统</h2>
    10         <?php
    11             switch(@$_GET['a']){
    12                 
    13                 case "create":
    14                     if(!empty($_POST['filename'])){
    15                         fopen($_POST['filename'],"x");
    16                     }    
    17                 break;
    18                 case "del":
    19                     $file=$_GET['filename'];
    20                     @unlink($file);
    21                 break;
    22                 case "updata":
    23                     $res= fopen($_POST['filename'],"w");
    24                     fwrite($res,$_POST['contents']);
    25                     fclose($res);
    26                 break;
    27                 
    28             }
    29         ?>
    30             <form action='index.php?a=create' method='post'>
    31                 文件名:<input type='text' name='filename'/>
    32                 <input type='submit' value='创建'/>
    33             </form>
    34             <table border='1' width='800'>
    35                 <tr>
    36                     <th>文件名</th><th>文件类型</th><th>文件大小</th><th>创建时间</th><th>操作</th>
    37                 </tr>
    38                 <?php
    39                     $path="./";
    40                     $res=opendir($path);
    41                     while(($f=readdir($res))!==false){
    42                         if($f=="."||$f==".."||$f=="index.php"){
    43                             continue;
    44                         }
    45                         $file=rtrim($path,"/")."/".$f;
    46                         echo "<tr align='center'>";
    47                             echo "<td>{$f}</td>";
    48                             echo "<td>".filetype($file)."</td>";
    49                             echo "<td>".filesize($file)."</td>";
    50                             echo "<td>".date("Y-m-d H:i:s",filectime($file))."</td>";
    51                             echo "<td><a href='index.php?a=edit&filename={$f}'>修改</a> <a href='index.php?a=del&filename={$file}'>删除</a></td>";
    52                         echo "</tr>";
    53                     }
    54                     closedir($res);
    55                 ?>
    56             </table>
    57             <?php
    58                 if(@$_GET['a']=="edit"){
    59             ?>
    60                 <h2>修改文件内容</h2>
    61                 <form action='index.php?a=updata' method='post'>
    62                     文件名:<?php echo $f ?><br>
    63                     文件内容:<textarea name="contents" cols='30' rows='5'><?php echo file_get_contents($_GET['filename']) ?></textarea>
    64                     <input type='hidden' name="filename" value="<?php echo $_GET['filename']; ?>" />
    65                     <input type='submit' value='修改'>
    66                 </form>
    67             <?php        
    68                 }
    69             ?>
    70         </center>
    71     </body>
    72 </html>
  • 相关阅读:
    图像处理之理解卷积
    图像卷积与滤波的一些知识点
    利用SynchronizationContext.Current在线程间同步上下文
    C#基础之 --- 消息队列例子
    c#子线程与主线程之间的通信
    映美精相机软触发
    halcon例程学习笔记(11) 一维码、二维码识别
    C#的分布式消息队列介绍
    相似、仿射、射影变换区别
    配置管理
  • 原文地址:https://www.cnblogs.com/yexiang520/p/5551598.html
Copyright © 2011-2022 走看看