note 114042 modified in function.spl-autoload-register by tularis
| From: | tularis@php.net | Date: | Mon, 06 Jan 2014 11:48:53 +0000 |
| Subject: | note 114042 modified in function.spl-autoload-register by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-198125@lists.php.net to get a copy of this message | ||
if you have a dir-structure like "/abc/def/ghi", your index.php lies in the top directory,
but you want to use namespaces starting with "def" or "ghi":
you can switch the namespace root directory of php with e.g. set_include_path(__DIR__ .
'/abc') and afterwards define + use your namespaces with the simple
spl_autoload_register() function without any arguments supplied.
remember that php handlers "cli" and "cli-server" are special cases.
--was--
sorry my last comment contained an error and might be deleted. this is the corrected version:
if you have a dir-structure like "/abc/def/ghi", your index.php lies in the top directory,
but you want to use namespaces starting with "def" or "ghi":
you can switch the namespace root directory of php with e.g. set_include_path(__DIR__ .
'/abc') and afterwards define + use your namespaces with the simple
spl_autoload_register() function without any arguments supplied.
remember that php handlers "cli" and "cli-server" are special cases.
http://php.net/manual/en/function.spl-autoload-register.php