note 99385 deleted from reserved.variables.server by danbrown
| From: | danbrown@php.net | Date: | Sat, 14 Aug 2010 00:36:29 +0000 |
| Subject: | note 99385 deleted from reserved.variables.server by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-171667@lists.php.net to get a copy of this message | ||
Note Submitter: fyrye at torntech dot com
----
@piana at pyrohawk dot com
Do keep in mind that REQUEST_URL is not a default index of $_SERVER.
And will throw: Notice: Undefined index: REQUEST_URL
Some frameworks and hosts do however add it in there packages.
To imitate a REQUEST_URL you can use REQUEST_URI like so:
<?php
$queryString = $_SERVER['QUERY_STRING'];
$_SERVER['REQUEST_URL'] = (isset($_SERVER['REQUEST_URI']))?
trim(str_replace("?$queryString", '', $_SERVER['REQUEST_URI']),
'/') : "";
print($_SERVER['REQUEST_URL']);
?>