__FILE__
always returns the file name where it is. If used inside an include, the name of the included file is returned.
So if the code is in number.php
, then __FILE__
will be number.php
.
You could use $_SERVER['PHP_SELF']
instead, which returns the filename of the currently executing script, relative to the document root.
2
solved if (basename(__FILE__) == xxx.php)… Stops Working When Included?