note 74621 deleted from function.dirname by colder
| From: | colder@php.net | Date: | Fri, 20 Apr 2007 15:27:06 +0000 |
| Subject: | note 74621 deleted from function.dirname by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-125685@lists.php.net to get a copy of this message | ||
Note Submitter: ahsan dot smiles at gmail dot com
Reason: bad code
----
to gain the current directory path
just type
<?php
$proto="http://";
$ser= $_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']);
echo $proto.$ser
?>
e.g
if http_host= ahsan.com
if php_self = /email/
then
the output will be
http://ahsan.com/email/
if we add
."/Home/";
after ['PHP_SELF'] i.e;
$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/Home/;
then the out put will be
http://ahsan.com/email/Home/
trailing slashes can be removed....
According to our choices