Reputation: 3831
I know about dirname(__FILE__)
, which returns the directory of the script that calls the function. Is there a way to get the directory of where the class that is returned with get_called_class()
is defined?
Upvotes: 0
Views: 108
Reputation: 16709
Use ReflectionClass
:
$reflector = new ReflectionClass(get_called_class());
print dirname($reflector->getFileName()));
(this won't work for internal classes :)
Upvotes: 1