PHP文件创建、复制、移动、删除文件
html代码如下:
- <html>
- <head>
- <meta http-equiv="content-type" content="text/html; charset=gb2312">
- <title>创建、复制、移动、删除文件</title>
- <style type="text/css教程">
- <!--
- body {
- margin-left: 00px;
- margin-top: 0px;
- margin-right: 0px;
- margin-bottom: 0px;
- }
- -->
- </style></head>
- <body>
- <table width="350" cellpadding="0" cellspacing="0">
- <tr>
- <td><table width="350" height="80" cellpadding="0" cellspacing="0" background="images/326ssss.gif">
- <form name="form1" method="post" action="index.php教程">
- <tr>
- <td width="95" height="39"> </td>
- <td width="171" rowspan="2" align="left" valign="middle"> <input name="fopens" type="text" size="22"></td>
- <td width="84" rowspan="2" valign="middle"><input name="submit4" type="submit" value="提交"></td>
- </tr>
- <tr>
- <td height="41"> </td>
- </tr>
- </form>
- </table></td>
- </tr>
- <tr>
- <td><table width="350" height="80" cellpadding="0" cellspacing="0" background="images/326s.gif">
- <form name="form1" method="post" action="index.php">
- <tr>
- <td width="111" height="39"> </td>
- <td width="155" valign="bottom"><input name="copys" type="text" size="20">
- </td>
- <td width="84" rowspan="2" valign="middle"><input type="submit" name="submit" value="提交"></td>
- </tr>
- <tr>
- <td height="41"> </td>
- <td valign="top"><input name="copy2" type="text" size="20"></td>
- </tr>
- </form>
- </table></td>
- </tr>
- <tr>
- <td><table width="350" height="80" cellpadding="0" cellspacing="0" background="images/326ss.gif">
- <form name="form1" method="post" action="index.php">
- <tr>
- <td width="111" height="39"> </td>
- <td width="115" valign="bottom"><input name="moves" type="text" size="20">
- </td>
- <td width="84" rowspan="2"><input type="submit" name="submit2" value="提交"></td>
- </tr>
- <tr>
- <td height="41"> </td>
- <td valign="top"><input name="moves2" type="text" size="20"></td>
- </tr>
- </form>
- </table></td>
- </tr>
- <tr>
- <td><table width="350" height="80" cellpadding="0" cellspacing="0" background="images/326sss.gif">
- <form name="form1" method="post" action="index.php">
- <tr>
- <td width="104"> </td>
- <td width="236"><input name="delete" type="text" >
- <input type="submit" name="submit3" value="提交"></td>
- </tr>
- </form>
- </table></td>
- </tr>
- </table>
- </body>
- </html>
php代码如下:
- <?php session_start();
- if($submit=="提交"){
- $copy=$_post[copys];
- $copys2=$_post[copy2];
- if(copy($copy,$copys2)==true){echo "复制成功!!";}else{echo "失败!!";};
- }
- if($submit2=="提交"){
- $moves=$_post[moves];
- $moves2=$_post[moves2];
- if(rename($moves,$moves2)==true){echo "移动成功!!";}else{echo "失败!!";};
- }
- if($submit3=="提交"){
- $delete=$_post[delete];
- if(unlink($delete)==true){echo "删除成功!!";}else{echo "失败!!";};
- }
- if($submit4=="提交"){
- $fopens=$_post[fopens];
- if(fopen($fopens,"w")==true){echo "创建成功!!";}else{echo "失败!!";};
- }
- //开源代码phpfensi.com
- ?>