xenophobia Posted March 9, 2008 Share Posted March 9, 2008 Alright let go to the problems here: Let say I got a php file: file_1.php with the following simple code: <?php includes("mypath/file_2.php"); ?> Lets say in file_2.php : <?php echo $_SERVER['SCRIPT_NAME']; ?> As you can see, it is very simple. The file_1.php will include one file from the mypath directory called file_2.php. So when I run the file_1.php, the output will be: file_1.php So how am I going to print /mypath/file_2.php since the output (echo) function are invoke in file_2.php. Thanks. Quote Link to comment Share on other sites More sharing options...
Xajel Posted March 9, 2008 Share Posted March 9, 2008 include or require does NOT execute the included file in it's path, so you will hvae another way to do this... - enter the path manually. you may use str_replace() to replace the pathes with the one you choosed, this is better in my opinion... - use fopen() to a file_1.php file rather than include and read the first line ( refere to file read usage for more info ), and without changes in file_2.php. in this case the server will execute file_2.php in it's path then give the results to file_1.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.