Get filename of file which ran PHP include

后端 未结 7 2192
后悔当初
后悔当初 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

    Got this from here: https://stackoverflow.com/a/35622743/9270227

    echo "Parent full URL: ";
    echo $_SERVER["SCRIPT_FILENAME"] . '
    ';

提交回复
热议问题