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

前端 未结 11 2547
北恋
北恋 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:41

    If your browser formats JSON documents nicely and no output has taken place, inserting the following will result in something more readable than var_dump:

    header('Content-Type: application/json');die(json_encode($_SERVER));
    

    phpinfo() will also provide a list of all $_SERVER values and so much more!

提交回复
热议问题