Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
您如何检索包含或需要它的脚本的名称?
示例:脚本 login.php 有一个 require_once('validate.php') ... validate.php 也被许多其他脚本调用。除了手动设置标志之外,有没有办法让 validate.php 知道哪个脚本包含/需要它?
尝试$_SERVER['SCRIPT_NAME'];
$_SERVER['SCRIPT_NAME'];
更多信息:http: //php.net/manual/en/reserved.variables.server.php