note 96679 added to language.oop5.autoload
| From: | tomatrdotje at osu1 dot php dot net | Date: | Thu, 11 Mar 2010 11:30:28 +0000 |
| Subject: | note 96679 added to language.oop5.autoload | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-166898@lists.php.net to get a copy of this message | ||
To find out whether a class can be autoloaded, you can use autoload in this way:
<?php
//Define autoloader
function __autoload($className) {
if (file_exists($className . '.php')) require $className . '.php';
else throw new Exception('Class "' . $className . '" could not be
autoloaded');
}
function canClassBeAutloaded($className) {
try {
class_exists($className);
return true;
}
catch (Exception $e) {
return false;
}
}
?>
----
Server IP: 78.110.173.36
Probable Submitter: 195.149.46.150
----
Manual Page -- http://www.php.net/manual/en/language.oop5.autoload.php
Edit -- https://master.php.net/note/edit/96679
Del: integrated -- https://master.php.net/note/delete/96679/integrated
Del: useless -- https://master.php.net/note/delete/96679/useless
Del: bad code -- https://master.php.net/note/delete/96679/bad+code
Del: spam -- https://master.php.net/note/delete/96679/spam
Del: non-english -- https://master.php.net/note/delete/96679/non-english
Del: in docs -- https://master.php.net/note/delete/96679/in+docs
Del: other reasons-- https://master.php.net/note/delete/96679
Reject -- https://master.php.net/note/reject/96679
Search -- https://master.php.net/manage/user-notes.php