找出包含当前脚本的最后一个脚本的名称
假设我有 3 个脚本,主/顶部脚本包括第二个脚本,而第二个脚本又包括第三个脚本。让我把它画出来,这样就清楚了。
[顶级脚本]-> [二级脚本]-> [第三级脚本]
那么,有没有一种简单的方法可以从第三级脚本获取“第二级脚本”的名称,也许有一些预定义的常量,第二级脚本包含的第三级脚本是否知道其父级?
请不要 SCRIPT_NAME 或 PHP_SELF 我,我知道它是什么,当我在最后包含的脚本中使用它时,它会显示“顶级脚本”的名称。我需要父母的名字,而不是祖父的名字!
Let's say I have 3 scripts, the main/top one which includes second which in turn includes a third. Let me draw that so it be clear.
[top level script] -> [second level script] -> [third level script]
So, is there a easy way to get a name of the "second level script" from the third, maybe there's some predefined constant, does the third script included by the second one know its parent?
Please don't SCRIPT_NAME or PHP_SELF me, I know what is it and when I use it inside of a last included script it shows me the name of the "top level script". I need the name of a parent, not a grandfather!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
get_included_files
应该是有用。将以下代码放入 2 级或 3 级文件中:get_included_files
should be useful. Place the following code in level 2 or level 3 file: