note 32059 deleted from function.dirname by danbrown

From: Date: Sun, 20 Jul 2008 19:09:35 +0000
Subject: note 32059 deleted from function.dirname by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142277@lists.php.net to get a copy of this message
Note Submitter: info at gieson dot com ---- 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

« previous php.notes (#142277) next »