首頁  >  文章  >  後端開發  >  $_SERVER的问题,我说为什么一直url重写失败,去不掉index.php

$_SERVER的问题,我说为什么一直url重写失败,去不掉index.php

WBOY
WBOY原創
2016-06-23 14:01:09763瀏覽

有的主机url重写后
$_SERVER['PATH_INFO']会消失,
取而代之的是
$_SERVER["ORIG_PATH_INFO"]
从而导致,根据$_SERVER['PATH_INFO']判断来去掉index.php会失效
我只是发现了这个现象,却不明白原理是为什么?


回复讨论(解决方案)

PATH_INFO is missing but ORIG_PATH_INFO is there with the information PATH_INFO was supposed to have.

So the php code had to be changed to check for $_SERVER['ORIG_PATH_INFO'] when $_SERVER['PATH_INFO'] is absent

见  http://www.binarytides.com/path_info-orig_path_info-apache-and-php/ 最后一段

PATH_INFO is missing but ORIG_PATH_INFO is there with the information PATH_INFO was supposed to have.

So the php code had to be changed to check for $_SERVER['ORIG_PATH_INFO'] when $_SERVER['PATH_INFO'] is absent

见  http://www.binarytides.com/path_info-orig_path_info-apache-and-php/ 最后一段
终于啊~
随心所欲的改变url了,
版主也来支持一下啊,个人作品 http://bbs.youyax.com/

你这个东东定型了吗?

你这个东东定型了吗?
大概是这样子了,后期也没啥功能需要开发了,

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn