BrainPill Posted October 27, 2019 Share Posted October 27, 2019 (edited) 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 October 27, 2019 by BrainPill Link to comment Share on other sites More sharing options...
dsonesuk Posted October 27, 2019 Share Posted October 27, 2019 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 More sharing options...
BrainPill Posted October 27, 2019 Author Share Posted October 27, 2019 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 More sharing options...
dsonesuk Posted October 27, 2019 Share Posted October 27, 2019 https://stackoverflow.com/questions/1307376/php-list-all-includes Link to comment Share on other sites More sharing options...
BrainPill Posted October 29, 2019 Author Share Posted October 29, 2019 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 More sharing options...
dsonesuk Posted October 29, 2019 Share Posted October 29, 2019 I think you need to loop these files then identify if they have include etc Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now