Ver Mensaje Individual
  #2 (permalink)  
Antiguo 02/02/2007, 06:55
Avatar de Marvin
Marvin
Colaborador
 
Fecha de Ingreso: febrero-2005
Ubicación: global $Chile->Santiago;
Mensajes: 1.991
Antigüedad: 19 años, 2 meses
Puntos: 81
Re: Carpeta no publica

En el mismo sitio de la funcion dirname() en php.net encontre esto:
Cita:
Iniciado por 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