How To Identify The Requested Page In PHP

后端 未结 5 1518
栀梦
栀梦 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:29

    1. parse_url($_SERVER['REQUEST_URI']) and then pathinfo($path) to get requested filename
    2. $_SERVER['PHP_SELF'] to get real filename
    3. $_SERVER['SCRIPT_NAME'] to get real filename

提交回复
热议问题