note 114015 deleted from language.oop5.autoload by crell
| From: | crell@php.net | Date: | Mon, 04 Apr 2022 16:08:17 +0000 |
| Subject: | note 114015 deleted from language.oop5.autoload by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218020@lists.php.net to get a copy of this message | ||
Note Submitter: pier4r
----
Just a small autoload class (that works if you use corretly names, namespaces, uses and so on) found
elsewhere with a small modification for linux:
<?php
//from http://www.phpfreaks.com / tutorial / oo - php - part
- 1 - oop - in - full - effect
function __autoload($className) {
var_dump($className);
$file = str_replace('\\', DIRECTORY_SEPARATOR, $className) . '.php';
var_dump($file);
var_dump(file_exists($file));
if (!file_exists($file)) {
return false;
}
else {
require $file;
return true;
}
}
?>