note 94083 added to reserved.variables.server
| From: | cj dot wijtmans at gmail dot com | Date: | Thu, 15 Oct 2009 15:44:23 +0000 |
| Subject: | note 94083 added to reserved.variables.server | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-161770@lists.php.net to get a copy of this message | ||
Hello php community.
I am using apache rewrite to turn php url's into simple urls. In my system i had problems
including CSS/JS/img since the search path for "127.0.0.1/news/3" is different than
"127.0.0.1/?page=newsitem&newsid=3".
so i wrote this rather inefficient solution:
[code] self::$path = './';
$path = str_replace(str_replace('\\', '/',
dirname(dirname(__DIR__)).'/'), '',
$_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI']);
$c = explode('/', $path);
while(next($c) !== false)
self::$path .= '../';[/code]
If anyone can improve this code will be welcome. And it must take account of windows using \ instead
of /.
Greets CJ.
----
Server IP: 192.41.40.227
Probable Submitter: 94.208.200.114
----
Manual Page -- http://www.php.net/manual/en/reserved.variables.server.php
Edit -- https://master.php.net/note/edit/94083
Del: integrated -- https://master.php.net/note/delete/94083/integrated
Del: useless -- https://master.php.net/note/delete/94083/useless
Del: bad code -- https://master.php.net/note/delete/94083/bad+code
Del: spam -- https://master.php.net/note/delete/94083/spam
Del: non-english -- https://master.php.net/note/delete/94083/non-english
Del: in docs -- https://master.php.net/note/delete/94083/in+docs
Del: other reasons-- https://master.php.net/note/delete/94083
Reject -- https://master.php.net/note/reject/94083
Search -- https://master.php.net/manage/user-notes.php