note 53851 added to language.oop5.autoload
| From: | PrzemekG_ at poczta dot onet dot pl | Date: | Wed, 15 Jun 2005 10:27:52 +0000 |
| Subject: | note 53851 added to language.oop5.autoload | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90451@lists.php.net to get a copy of this message | ||
This is a little more usefull code (modified from nhartkamp at eljakim dot N0SP4M dot nl)
<?php
function __autoload ($class_name) {
$file = 'system/objects/' . $class_name . '.inc.php';
if (!file_exists ($file)) {
return eval ("class $class_name {" .
" function $class_name ($a=0, $b=0, $c=0, $d=0, $e=0, $f=0, $g=0, $h=0, $i=0)
{" .
" throw new Exception ();" .
" }" .
"}");
}
require_once ($file);
}
?>
Adding some arguments to the constructor will prevent errors about argument count.
----
Manual Page -- http://www.php.net/manual/en/language.oop5.autoload.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53851
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53851&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53851&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53851&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53851&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53851&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53851&report=yes
Search -- http://master.php.net/manage/user-notes.php