Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
528 views
in Technique[技术] by (71.8m points)

include - PHP - retrieve name of script that included or required it

How do you retrieve the name of the script that included or required it?

Example: script login.php has a require_once('validate.php') ... validate.php is also called by a number of other scripts. Other than manually setting a flag, is there a way to have validate.php know which script is including/requiring it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try $_SERVER['SCRIPT_NAME'];

More here: http://php.net/manual/en/reserved.variables.server.php


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...