Get name of file that is including a PHP script

后端 未结 6 2012
遇见更好的自我
遇见更好的自我 2020-12-16 11:22

Here is an example of what I am trying to do:

index.php

list.php

6条回答
  •  一向
    一向 (楼主)
    2020-12-16 11:54

    The solution basename($_SERVER['PHP_SELF']) works but I recommend to put a strtolower(basename($_SERVER['PHP_SELF'])) to check 'Index.php' or 'index.php' mistakes.

    But if you want an alternative you can do:
    .

提交回复
热议问题