WN

WN (https://www.wn.se/forum/index.php)
-   Serversidans teknologier (https://www.wn.se/forum/forumdisplay.php?f=4)
-   -   REQUEST_URI fungerar ej... (https://www.wn.se/forum/showthread.php?t=28911)

grinditwp 2008-04-25 15:26

Kan någon förklara för mig varför $_SERVER["REQUEST_URI"] inte fungerar? Blir bara blank, visar inget.
Har det med webbservern att göra?

Servern är windows baserad, kör PHP 5.

Övriga $_SERVER jag testat verkar fungera, så som,
$_SERVER['PHP_SELF'],
$_SERVER['HTTP_HOST'],
$_SERVER['SCRIPT_NAME'],
$_SERVER['HTTP_ACCEPT'],
$_SERVER['HTTP_CONNECTION'],
$_SERVER['HTTP_ACCEPT_LANGUAGE']

Men varför fungerar ej $_SERVER["REQUEST_URI"]. Finsn det något annat sätt jag kan få reda på denna information?

wooper 2008-04-25 15:32

Hittade detta på php.net vilket kanske hjälper:

Citat:

The *only* way to make Request_URI work as a 100% Apache-Compliant server variable on IIS/Windows is to use an Isapi Filter - as documented at http://neosmart.net/blog/archives/291 . The various steps mentioned below *completely* fail when a rewrite engine is employed, since IIS will *never* return a non-existent path (i.e. the actual pretty-URI used) via its server variables.

This also applies to accessing index.php via a folder.
For instance, calls made to /folder/ will appear as /folder/index.php and not /folder/.

The fix is to use the ISAPI filter provided at http://neosmart.net/blog/archives/291

You don't have to modify any of the actual scripts once this filter is in place - it automatically intercepts calls to REQUEST_URI and replaces them with the actual user-entered path.

Länk: http://se2.php.net/reserved.variables

objx 2008-04-27 23:07

kolla om $_SERVER['SCRIPT_URI'] är läsbart.


Alla tider är GMT +2. Klockan är nu 23:38.

Programvara från: vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Svensk översättning av: Anders Pettersson