On Thu, 05 Oct 2006 16:35:04 +0200, Javier Ruiz wrote:
> Perfect!
>
> got it using the following:
>
> /* 1 - remove the query string just in case it contains a '/' in it
>2 - like Clive said, substr() and strrpos() 'clean' the path to provide
> the directories only */
>
> $aPath = str_repla
On Thu, October 5, 2006 8:42 am, Javier Ruiz wrote:
> Is it possible to get the path of a file relative to the document root
> of
> the webserver using php?
> For example...
>
> if we have a script like
> http://localhost/mydir/myseconddir/index.php
>
> is there a way to get that it's runing on
> /
Perfect!
got it using the following:
/* 1 - remove the query string just in case it contains a '/' in it
2 - like Clive said, substr() and strrpos() 'clean' the path to provide
the directories only */
$aPath = str_replace($_REQUEST['QUERY_STRING'], '',
$_SERVER['SCRIPT_NAME']);
$aPath = subst
if we have a script like
http://localhost/mydir/myseconddir/index.php
is there a way to get that it's runing on
/mydir/myseconddir/
use $_SERVER['[PHP_SELF'] or $_SERVER['SCRIPT_NAME']
and then simply use strripos() to get the last forwarsd-slash and
substr() to get the value you want.
Javier Ruiz wrote:
Hey all!
Is it possible to get the path of a file relative to the document root of
the webserver using php?
For example...
if we have a script like
http://localhost/mydir/myseconddir/index.php
is there a way to get that it's runing on
/mydir/myseconddir/
??
something like
Hey all!
Is it possible to get the path of a file relative to the document root of
the webserver using php?
For example...
if we have a script like
http://localhost/mydir/myseconddir/index.php
is there a way to get that it's runing on
/mydir/myseconddir/
??
something like getcwd() but webserv
6 matches
Mail list logo