PHP/File Directory/File Copy Move — различия между версиями

Материал из Web эксперт
Перейти к: навигация, поиск
м (1 версия)
 
м (1 версия)
 
(нет различий)

Текущая версия на 07:04, 26 мая 2010

Rename() function for moving files

<?php
   $source = "./test.txt";
   $destination = "./copy.txt";
                 
   if (rename($source, $destination)) {
      echo "The file was moved successfully.", "\n";
   } else {
      echo "The specified file could not be moved. Please try again.", "\n";
   }
?>



Use of the copy() function

<?php
   $source = "./test.txt";
   $destination = "./copy.txt";
                
   if(copy($source, $destination)) {
      echo "File copied successfully.", "\n";
   } else {
      echo "The specified file could not be copied. Please try again.", "\n";
   }
               
?>