note 15519 added to function.file-exists
| From: | wildpeaks at warpdawg dot com | Date: | Sat, 15 Sep 2001 02:45:13 +0000 |
| Subject: | note 15519 added to function.file-exists | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-18033@lists.php.net to get a copy of this message | ||
For testing the existence of a file (remote ones too):
function isAfile($url){
$temp = error_reporting(E_ALL & ~(E_ERROR | E_WARNING | E_PARSE | E_NOTICE |
E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_USER_ERROR |
E_USER_WARNING | E_USER_NOTICE));
$file = fopen ("$url", "r");
error_reporting($temp);
if (!$file) return 0;
return 1;
}
Return 1 if file exists, 0 if not.
http://www.php.net/manual/fr/function.file-exists.php