note 97837 added to function.spl-autoload-register
| From: | ryanhennessy at idontwanttotell dot com | Date: | Tue, 11 May 2010 14:48:16 +0000 |
| Subject: | note 97837 added to function.spl-autoload-register | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-169146@lists.php.net to get a copy of this message | ||
If you want your autoload to be within a class you can do the following:
class exampleClass{
function __construct(){
spl_autoload_register(array("exampleClass","myAutoLoad"));
}
static myAutoLoad($class){
require_once $class.'.php';
}
public function creatClass(){
$obj = new someClass();
}
}
----
Server IP: 69.147.83.197
Probable Submitter: 99.23.143.205
----
Manual Page -- http://www.php.net/manual/en/function.spl-autoload-register.php
Edit -- https://master.php.net/note/edit/97837
Del: integrated -- https://master.php.net/note/delete/97837/integrated
Del: useless -- https://master.php.net/note/delete/97837/useless
Del: bad code -- https://master.php.net/note/delete/97837/bad+code
Del: spam -- https://master.php.net/note/delete/97837/spam
Del: non-english -- https://master.php.net/note/delete/97837/non-english
Del: in docs -- https://master.php.net/note/delete/97837/in+docs
Del: other reasons-- https://master.php.net/note/delete/97837
Reject -- https://master.php.net/note/reject/97837
Search -- https://master.php.net/manage/user-notes.php