$_SERVER[“SCRIPT_URI”] not working? alternative?

前端 未结 11 2533
北恋
北恋 2020-12-17 17:17

This is odd, but for some reason the $_SERVER[\"SCRIPT_URI\"] will not return the domain name when I am in child/sub-pages but will only work on the main page.

11条回答
  •  南方客
    南方客 (楼主)
    2020-12-17 17:29

    Also, SCRIPT_URI does not exist, the right syntax is REQUEST_URI:

    echo $_SERVER["REQUEST_URI"]; It returns the whole path without the host and domain.

提交回复
热议问题