note 130316 added to function.spl-autoload

From: Date: Mon, 26 May 2025 10:34:55 +0000
Subject: note 130316 added to function.spl-autoload
Groups: php.notes 
Request: Send a blank email to php-notes+get-222166@lists.php.net to get a copy of this message
class Autocarga { public static function registra_autocarga() { try { spl_autoload_register(self::class . "::autocarga"); } catch(Exception $e) { echo "La definición de la clase no se ha encontrado"; exit(1); } } public static function autocarga($clase): void { $directorios = ['periodoRecuperacion\\ra5\\']; $clase = str_replace("\\", "/", $clase); $encontrado = False; foreach($directorios as $directorio ) { if( file_exists("{$_SERVER['DOCUMENT_ROOT']}/$directorio/$clase.php") ) { require_once("{$_SERVER['DOCUMENT_ROOT']}/$directorio/$clase.php"); $encontrado = True; break; } } if( !$encontrado ) throw new Exception("La clase $clase no existe"); } } ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.137 (proxied: 94.73.34.245) ---- Manual Page -- https://php.net/manual/en/function.spl-autoload.php Edit -- https://main.php.net/note/edit/130316 Del: integrated -- https://main.php.net/note/delete/130316/integrated Del: useless -- https://main.php.net/note/delete/130316/useless Del: bad code -- https://main.php.net/note/delete/130316/bad+code Del: spam -- https://main.php.net/note/delete/130316/spam Del: non-english -- https://main.php.net/note/delete/130316/non-english Del: in docs -- https://main.php.net/note/delete/130316/in+docs Del: other reasons-- https://main.php.net/note/delete/130316 Reject -- https://main.php.net/note/reject/130316 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#222166) next »