Get filename of file which ran PHP include

后端 未结 7 2183
后悔当初
后悔当初 2020-11-28 11:47

When using the PHP include, how can I find out which file is calling the include? In short, what is the parent\'s file filename?

7条回答
  •  半阙折子戏
    2020-11-28 12:37

    Late answer, but ...

    I check the running parent filename by using:

    $_SERVER["SCRIPT_NAME"] // or 
    $_SERVER["REQUEST_URI"] // (with query string)
    

提交回复
热议问题