note 23813 added to ref.filesystem
| From: | shadowt@php.net | Date: | Mon, 29 Jul 2002 12:48:02 +0000 |
| Subject: | note 23813 added to ref.filesystem | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-33869@lists.php.net to get a copy of this message | ||
@lee:
touch() is one way, but if the file already exists, u will only modify its timestamp (at least
afaik, i may b mistaken). so one way is to check whether the file exists (file_exists()) or simpler,
in my opinion, try: $fd=fopen("foo.txt","w"); which creates an empty file or
empties the file if it exists and afterwards you use a fclose($fd); now u have an empty file, no
matter whether it already existed or not.....
cy.t
--
http://www.php.net/manual/en/ref.filesystem.php
http://master.php.net/manage/user-notes.php?action=edit+23813
http://master.php.net/manage/user-notes.php?action=delete+23813
http://master.php.net/manage/user-notes.php?action=reject+23813