note 32059 added to function.dirname

From: Date: Wed, 14 May 2003 23:40:39 +0000
Subject: note 32059 added to function.dirname
Groups: php.notes 
Request: Send a blank email to php-notes+get-48002@lists.php.net to get a copy of this message
This one will put both the "www" and "file" path into an easy to transport array. <?php // build the www path: $me = $_SERVER['PHP_SELF']; $Apathweb = explode("/", $me); $myFileName = array_pop($Apathweb); $pathweb = implode("/", $Apathweb); $myURL = "http://".$_SERVER['HTTP_HOST'].$pathweb."/".$myFileName; $PAGE_BASE['www'] = $myURL; // build the file path: strstr( PHP_OS, "WIN") ? $strPathSeparator = "\\" : $strPathSeparator = "/"; $pathfile = getcwd (); $PAGE_BASE['physical'] = $pathfile.$strPathSeparator.$myFileName; // this is so you can verify the results: $www = $PAGE_BASE['www']; $physical = $PAGE_BASE['physical']; echo "$physical<p>"; echo "$www<p>"; The following will return something like: Windows: F:\dev\Inetpub\wwwroot\somedirectory\index.php http://devserver/somedirectory/index.php Unix: /home/somepathto/gieson.com/webroot/index.php http://www.gieson.com/index.php ?> -- http://www.php.net/manual/en/function.dirname.php http://master.php.net/manage/user-notes.php?action=edit+32059 http://master.php.net/manage/user-notes.php?action=delete+32059 http://master.php.net/manage/user-notes.php?action=reject+32059

« previous php.notes (#48002) next »