| Newsgroups |
php.notes |
| Message-ID |
<[email protected]> |
<?php
namespace util;
class Autocarga
{
public static function registraAutocarga(): void
{
spl_autoload_register([self::class, 'autocarga']);
}
public static function autocarga(string $clase): void
{
$archivo = __DIR__ . '/../'. str_replace('\\', '/', $clase). '.php';
if (file_exists($archivo)) {
require_once $archivo;
} else {
echo "No existe el archivo $archivo";
}
}
}
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 94.73.34.245)
----
Manual Page -- https://php.net/manual/en/language.oop5.autoload.php
Edit -- https://main.php.net/note/edit/130360
Del: integrated -- https://main.php.net/note/delete/130360/integrated
Del: useless -- https://main.php.net/note/delete/130360/useless
Del: bad code -- https://main.php.net/note/delete/130360/bad+code
Del: spam -- https://main.php.net/note/delete/130360/spam
Del: non-english -- https://main.php.net/note/delete/130360/non-english
Del: in docs -- https://main.php.net/note/delete/130360/in+docs
Del: other reasons-- https://main.php.net/note/delete/130360
Reject -- https://main.php.net/note/reject/130360
Search -- https://main.php.net/manage/user-notes.php