11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 10 • WORKING WITH THE FILE AND OPERATING SYSTEMwww.it-ebooks.info$dir = '/usr/local/apache2/htdocs/book/chapter10/test/';deleteDirectory($dir);Renaming a FileThe rename() function renames a file, returning TRUE on success and FALSE otherwise. Its prototypefollows:boolean rename(string oldname, string newname [, resource context])Because <strong>PHP</strong> scripts typically execute under the guise of the server daemon process owner, rename()will fail unless that user has write permissions to that file. The context parameter refers to a streamcontext. You’ll learn more about this topic in Chapter 16.Touching a FileThe touch() function sets the file filename‘s last-modified and last-accessed times, returning TRUE onsuccess or FALSE on error. Its prototype follows:int touch(string filename [, int time [, int atime]])If time is not provided, the present time (as specified by the server) is used. If the optional atimeparameter is provided, the access time will be set to this value; otherwise, like the modification time, itwill be set to either time or the present server time.Note that if filename does not exist, it will be created, assuming that the script’s owner possessesadequate permissions.250

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!