everbright Posted February 8, 2010 Share Posted February 8, 2010 Hi guys, Just wondering if anyone has any ideas how to do the following: D:/Programs/PHP/A.php function getPath() { ??? } D:/Programs/PHP/Sub/B.php include_once '../A.php'; print getPath(); What I want is for getPath to return the path of B.php (i.e. D:/Programs/PHP/Sub) when I run B.php. Anyone has any ideas how to do this? I've tried to use dirname(__FILE__), but that just returns the path of A.php, i.e. D:/Programs/PHP. Thanks in advance for any suggestions! Quote Link to comment https://forums.phpfreaks.com/topic/191356-getting-directory-path-of-parent-include-script/ Share on other sites More sharing options...
greatstar00 Posted February 8, 2010 Share Posted February 8, 2010 so, put the function in b.php if they always relative to the path of a then just put __FILE__."/sub"; Quote Link to comment https://forums.phpfreaks.com/topic/191356-getting-directory-path-of-parent-include-script/#findComment-1008857 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.