我在$_SERVER['PATH_INFO']本地主机上使用时出现以下错误:
Notice: Undefined index: PATH_INFO
Run Code Online (Sandbox Code Playgroud)
我正在使用WAMP.有人能告诉我为什么会这样吗?
Bri*_*ian 21
PATH_INFO并不总是设置.仅在脚本之后存在尾随路径信息时才设置它.
例如,如果你有一个文件位于:localhost/index.php你通过这个url访问它:localhost/index.php/foo/bar
然后 $ _SERVER ['PATH_INFO']将被设置为值"/ foo/bar"
但是如果你通过url:localhost/index.php访问脚本,那么就不会设置PATH_INFO,你会看到类似的通知,试图访问一个未定义的数组索引
如果您的网址看起来像这样,
http://localhost/则表示$_SERVER['PATH_INFO']尚未设置。