简体   繁体   中英

include php from included file

i want to include php file in other php file but i dont want to use include or require function in first file, for example i have 'to_include.php' and 'main.php' then include in normal way is:

in 'main.php':

include('to_include.php');

but i dont want to do this, for example i want some thing like this:

in 'to_include.php':

include_this_file_to('main.php');

or any other way that can help me to do this.

Note: i dont want to do this too:

in 'third_file.php':

include('to_include.php');
include('main.php');

I'm pretty sure there's no way to do what you're trying to do. It would require PHP to search the entire filesystem to see if there's another script that contains a relevant include_this_file_to() call, which hardly seems practical.

The best I can think of is to use your third_file.php , and then have the server rewrite main.php to third_file.php .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM