note 72633 added to function.dirname
| From: | hans111 at yahoo dot com | Date: | Sat, 27 Jan 2007 00:25:15 +0000 |
| Subject: | note 72633 added to function.dirname | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-122253@lists.php.net to get a copy of this message | ||
The same function but a bit improved, will use REQUEST_URI, if not available, will use PHP_SELF and
if not available will use __FILE__, in this case, the function MUST be in the same file. It should
work, both under Windows and *NIX.
<?php
function my_dir(){
return end(explode('/', dirname(!empty($_SERVER['REQUEST_URI']) ?
$_SERVER['REQUEST_URI'] : !empty($_SERVER['PHP_SELF']) ?
$_SERVER['PHP_SELF'] : str_replace('\\','/',__FILE__))));
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 201.228.100.73
----
Manual Page -- http://www.php.net/manual/en/function.dirname.php
Edit -- https://master.php.net/note/edit/72633
Del: integrated -- https://master.php.net/note/delete/72633/integrated
Del: useless -- https://master.php.net/note/delete/72633/useless
Del: bad code -- https://master.php.net/note/delete/72633/bad+code
Del: spam -- https://master.php.net/note/delete/72633/spam
Del: non-english -- https://master.php.net/note/delete/72633/non-english
Del: in docs -- https://master.php.net/note/delete/72633/in+docs
Del: other reasons-- https://master.php.net/note/delete/72633
Reject -- https://master.php.net/note/reject/72633
Search -- https://master.php.net/manage/user-notes.php