note 76380 added to function.file-exists

From: Date: Thu, 12 Jul 2007 15:44:36 +0000
Subject: note 76380 added to function.file-exists
Groups: php.notes 
Request: Send a blank email to php-notes+get-128414@lists.php.net to get a copy of this message
/* * EXTERN/LOCAL FILE * a simple alternative */ function sys_file_exists($f = NULL) { $h = array(); $ret = FALSE; if(!is_null($f)): if(preg_match('/^http|https|ftp/',$f)): $h = @get_headers($f); if(array_key_exists(0,$h)) : $ret = @preg_match('/200|301/',$h[0]); /* HTTP/1.1 301 DAP */ endif; else: if(preg_match('/^relative:\/\//',$f)) : $f = str_replace('relative://','',$f); endif; $ret = (@file_exists($f) && @is_readable($f)); endif; endif; return (($ret === TRUE) ? TRUE : FALSE); } @+ ---- Server IP: 87.124.64.96 Probable Submitter: 80.169.153.20 ---- Manual Page -- http://www.php.net/manual/en/function.file-exists.php Edit -- https://master.php.net/note/edit/76380 Del: integrated -- https://master.php.net/note/delete/76380/integrated Del: useless -- https://master.php.net/note/delete/76380/useless Del: bad code -- https://master.php.net/note/delete/76380/bad+code Del: spam -- https://master.php.net/note/delete/76380/spam Del: non-english -- https://master.php.net/note/delete/76380/non-english Del: in docs -- https://master.php.net/note/delete/76380/in+docs Del: other reasons-- https://master.php.net/note/delete/76380 Reject -- https://master.php.net/note/reject/76380 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#128414) next »