VB.net 2010 视频教程 VB.net 2010 视频教程 python基础视频教程
SQL Server 2008 视频教程 c#入门经典教程 Visual Basic从门到精通视频教程
当前位置:
首页 > PHP >
  • PHP文件创建、复制、移动、删除文件

html代码如下:

  1. <html> 
  2. <head> 
  3. <meta http-equiv="content-type" content="text/html; charset=gb2312"
  4. <title>创建、复制、移动、删除文件</title> 
  5. <style type="text/css教程"
  6. <!-- 
  7. body { 
  8. margin-left: 00px; 
  9. margin-top: 0px; 
  10. margin-right: 0px; 
  11. margin-bottom: 0px; 
  12. --> 
  13. </style></head> 
  14. <body> 
  15. <table width="350" border="1" cellpadding="0" cellspacing="0"
  16. <tr> 
  17. <td><table width="350" height="80" border="0" cellpadding="0" cellspacing="0" background="images/326ssss.gif"
  18. <form name="form1" method="post" action="index.php教程"
  19. <tr> 
  20. <td width="95" height="39"> </td> 
  21. <td width="171" rowspan="2" align="left" valign="middle"> <input name="fopens" type="text" id="copy2" size="22"></td> 
  22. <td width="84" rowspan="2" valign="middle"><input name="submit4" type="submit" id="submit4" value="提交"></td> 
  23. </tr> 
  24. <tr> 
  25. <td height="41"> </td> 
  26. </tr> 
  27. </form> 
  28. </table></td> 
  29. </tr> 
  30. <tr> 
  31. <td><table width="350" height="80" border="0" cellpadding="0" cellspacing="0" background="images/326s.gif"
  32. <form name="form1" method="post" action="index.php"
  33. <tr> 
  34. <td width="111" height="39"> </td> 
  35. <td width="155" valign="bottom"><input name="copys" type="text" id="copys2" size="20"
  36. </td> 
  37. <td width="84" rowspan="2" valign="middle"><input type="submit" name="submit" value="提交"></td> 
  38. </tr> 
  39. <tr> 
  40. <td height="41"> </td> 
  41. <td valign="top"><input name="copy2" type="text" id="copy22" size="20"></td> 
  42. </tr> 
  43. </form> 
  44. </table></td> 
  45. </tr> 
  46. <tr> 
  47. <td><table width="350" height="80" border="0" cellpadding="0" cellspacing="0" background="images/326ss.gif"
  48. <form name="form1" method="post" action="index.php"
  49. <tr> 
  50. <td width="111" height="39"> </td> 
  51. <td width="115" valign="bottom"><input name="moves" type="text" id="moves3" size="20"
  52. </td> 
  53. <td width="84" rowspan="2"><input type="submit" name="submit2" value="提交"></td> 
  54. </tr> 
  55. <tr> 
  56. <td height="41"> </td> 
  57. <td valign="top"><input name="moves2" type="text" id="moves22" size="20"></td> 
  58. </tr> 
  59. </form> 
  60. </table></td> 
  61. </tr> 
  62. <tr> 
  63. <td><table width="350" height="80" border="0" cellpadding="0" cellspacing="0" background="images/326sss.gif"
  64. <form name="form1" method="post" action="index.php"
  65. <tr> 
  66. <td width="104"> </td> 
  67. <td width="236"><input name="delete" type="text" id="delete2"
  68. <input type="submit" name="submit3" value="提交"></td> 
  69. </tr> 
  70. </form> 
  71. </table></td> 
  72. </tr> 
  73. </table> 
  74. </body> 
  75. </html> 

php代码如下:

  1. <?php session_start(); 
  2. if($submit=="提交"){ 
  3. $copy=$_post[copys]; 
  4. $copys2=$_post[copy2]; 
  5. if(copy($copy,$copys2)==true){echo "复制成功!!";}else{echo "失败!!";}; 
  6. if($submit2=="提交"){ 
  7. $moves=$_post[moves]; 
  8. $moves2=$_post[moves2]; 
  9. if(rename($moves,$moves2)==true){echo "移动成功!!";}else{echo "失败!!";}; 
  10.  
  11. if($submit3=="提交"){ 
  12. $delete=$_post[delete]; 
  13. if(unlink($delete)==true){echo "删除成功!!";}else{echo "失败!!";}; 
  14. if($submit4=="提交"){ 
  15. $fopens=$_post[fopens]; 
  16. if(fopen($fopens,"w")==true){echo "创建成功!!";}else{echo "失败!!";}; 
  17. //开源代码phpfensi.com
  18. ?> 
  19.  

出处:http://www.phpfensi.com/php/20140816/4282.html


相关教程