Jump to content

tracking back include and require with a command


BrainPill

Recommended Posts

Is there a function or command in php to output the backtrack of include en require.

Like when you include a script in a file; the included script should be able to produce the track dump on the screen, so the programmer knows where from the include is coming.

 

Does that exist and what is the name of that command?

 

Or is there anyone that made an own function performing the action above and how?

 

 

Edited by BrainPill
Link to comment
Share on other sites

Php is processes by the server and sent back as html, so to use include or require you have to send it back to server by reloading page.

Your best option is to use ajax which sends a request to a php file using javascript the php is proceesed by server and returns output as html where you use response of ajax request to insert the returned html anywhere you want, for example a container with id reference .

Link to comment
Share on other sites

I dont know much about AJAX and dont believe your solution is what I try to ask.

 

Like var_dump verbose shows the location and the line number of a variable. Of course that is just an example of how PHP code can work.

 

What I want to say is that it is certainly very useful if there was a specific PHP command that could give a list of the scripts that links towards it with either include or require.

But I can't write PHP code myself. It could be people made it and that it might be scheduled for updates of PHP in the future.

Link to comment
Share on other sites

I see, but the example does not lead to the desired result.

its more like this:

script 1:

 

<?php
 
 include 'script2.php';

// execute code

?>

 

script 2:

 

<?php

fictive_phpfunction_to_track_back_include(); // of course this is pseudo code, just to give an example


----------------
/*
the example above will output

referred from: script1.php

*/

// script code



?>

 

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...