note 105539 added to language.oop5.autoload
| From: | Nic at osu1 dot php dot net | Date: | Thu, 25 Aug 2011 19:22:00 +0000 |
| Subject: | note 105539 added to language.oop5.autoload | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182733@lists.php.net to get a copy of this message | ||
Autoloading camel case classes, ie. loading "controller/product/detail.php" from
"ControllerProductDetail":
<?php
// Autoloading
function __autoload($class) {
$path = strtolower(preg_replace('/([a-z])([A-Z])/', '$1/$2', $class));
if(file_exists(DIR_APPLICATION . $path . '.php')) {
require_once(DIR_APPLICATION . $path . '.php');
}
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 79.226.255.45
----
Manual Page -- http://www.php.net/manual/en/language.oop5.autoload.php
Edit -- https://master.php.net/note/edit/105539
Del: integrated -- https://master.php.net/note/delete/105539/integrated
Del: useless -- https://master.php.net/note/delete/105539/useless
Del: bad code -- https://master.php.net/note/delete/105539/bad+code
Del: spam -- https://master.php.net/note/delete/105539/spam
Del: non-english -- https://master.php.net/note/delete/105539/non-english
Del: in docs -- https://master.php.net/note/delete/105539/in+docs
Del: other reasons-- https://master.php.net/note/delete/105539
Reject -- https://master.php.net/note/reject/105539
Search -- https://master.php.net/manage/user-notes.php