$ _SERVER ['PATH_INFO'] on the local host

I get the following error when I use $_SERVER['PATH_INFO'] on my localhost:

 Notice: Undefined index: PATH_INFO 

I am using WAMP. Can someone tell me why this is happening?

+4
source share
2 answers

If your URL looks like this http://localhost/ , then $_SERVER['PATH_INFO'] is not set.

+4
source

PATH_INFO is not always set. It is installed only if information about the end of the path appears after the script.

For example, if you have a file located here: localhost / index.php and you access it through this URL: localhost / index.php / foo / bar

then $ _SERVER ['PATH_INFO'] will be set to "/ foo / bar"

, but if you access the script via url: localhost / index.php, then PATH_INFO will not be set, and you will see a notification like this for trying to access the undefined index of an array

+21
source

Source: https://habr.com/ru/post/1403535/


All Articles