PHP文件创建、复制、移动、删除文件
发布:smiling 来源: PHP粉丝网 添加日期:2014-08-16 08:57:12 浏览: 评论:0
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" border="1" cellpadding="0" cellspacing="0">
- <tr>
- <td><table width="350" height="80" border="0" 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" id="copy2" size="22"></td>
- <td width="84" rowspan="2" valign="middle"><input name="submit4" type="submit" id="submit4" value="提交"></td>
- </tr>
- <tr>
- <td height="41"> </td>
- </tr>
- </form>
- </table></td>
- </tr>
- <tr>
- <td><table width="350" height="80" border="0" 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" id="copys2" 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" id="copy22" size="20"></td>
- </tr>
- </form>
- </table></td>
- </tr>
- <tr>
- <td><table width="350" height="80" border="0" 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" id="moves3" 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" id="moves22" size="20"></td>
- </tr>
- </form>
- </table></td>
- </tr>
- <tr>
- <td><table width="350" height="80" border="0" 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" id="delete2">
- <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
- ?>
Tags: PHP文件创建 PHP文件复制
- 上一篇:php创建文件函数
- 下一篇:php删除目录及目录下所有文件子目录
相关文章
- ·php文件打开、创建、读取fopen函数的使用说明(2014-09-13)
推荐文章
热门文章
最新评论文章
- 写给考虑创业的年轻程序员(10)
- PHP新手上路(一)(7)
- 惹恼程序员的十件事(5)
- PHP邮件发送例子,已测试成功(5)
- 致初学者:PHP比ASP优秀的七个理由(4)
- PHP会被淘汰吗?(4)
- PHP新手上路(四)(4)
- 如何去学习PHP?(2)
- 简单入门级php分页代码(2)
- php中邮箱email 电话等格式的验证(2)