note 115763 added to function.get-class

From: Date: Thu, 18 Sep 2014 20:55:28 +0000
Subject: note 115763 added to function.get-class
Groups: php.notes 
Request: Send a blank email to php-notes+get-200483@lists.php.net to get a copy of this message
If you want the path to an file if you have i file structure like this project -> system -> libs -> controller.php project -> system -> modules -> foo -> foo.php and foo() in foo.php extends controller() in controller.php like this <?PHP namespace system\modules\foo; class foo extends \system\libs\controller { public function __construct() { parent::__construct(); } } ?> and you want to know the path to foo.php in controller() this may help you <?PHP namespace system\libs; class controller { protected function __construct() { $this->getChildPath(); } protected function getChildPath() { echo dirname(get_class($this)); } } ?> <?PHP $f = new foo(); // system\modules\foo ?> ---- Server IP: 72.52.91.14 Probable Submitter: 178.24.116.117 ---- Manual Page -- http://php.net/manual/en/function.get-class.php Edit -- https://master.php.net/note/edit/115763 Del: integrated -- https://master.php.net/note/delete/115763/integrated Del: useless -- https://master.php.net/note/delete/115763/useless Del: bad code -- https://master.php.net/note/delete/115763/bad+code Del: spam -- https://master.php.net/note/delete/115763/spam Del: non-english -- https://master.php.net/note/delete/115763/non-english Del: in docs -- https://master.php.net/note/delete/115763/in+docs Del: other reasons-- https://master.php.net/note/delete/115763 Reject -- https://master.php.net/note/reject/115763 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#200483) next »