How To Identify The Requested Page In PHP

后端 未结 5 1378
栀梦
栀梦 2021-02-04 04:59

Is there any easy way to identify the file initially handling the request, ignoring get arguments and handling (at least basic) mappings like / to /index.php<

5条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-04 05:21

    $_SERVER['PHP_SELF']
    

    Should return the actual script. But there are various methods.

    I had a better link to a matrix of all the various file-related environment variables but I can't find it. I'll edit if it turns up.

    Edit: I found a nice SO thread that details the differences between them.

提交回复
热议问题