Jump to content
BrainPill

tracking back include and require with a command

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

Share this post


Link to post
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 .

Share this post


Link to post
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.

Share this post


Link to post
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



?>

 

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...