Jump to content

Getting directory path of parent include script


everbright

Recommended Posts

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.