[PHP-NOTES] note 130356 added to function.echo

[email protected] ("[email protected]")
Newsgroups php.notes
Message-ID <[email protected]>
<?php
echo "hello"

namespace util;

class Autocarga {
    public static function registraAutocarga() {
        if( !spl_autoload_register([self::class, "autocarga"]) ) {
            echo "Error en la autocarga";
        }
    }

    public static function autocarga(string $clase): void {
        $nombre_clase = str_replace("\\", "/", $clase);
        $carpetas = [
            '/ra7/rpc/modelo',      // Para clases RPC
            '/ra7/modelo',          // Para modelos REST
            '/ra7/orm/modelo',      // Para ORM
            '/ra7/enrutador'        // Para enrutador
        ];

        foreach($carpetas as $carpeta) {
            $ruta_completa = $_SERVER['DOCUMENT_ROOT'] . "{$carpeta}/{$nombre_clase}.php";
            if(file_exists($ruta_completa)) {
                require_once $ruta_completa;
                return;
            }
        }
        
        throw new \Exception("Clase {$clase} no encontrada en: " . implode(', ', $carpetas));
    }
}
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 2a0c:5a83:cc09:8c00:844a:3c50:fc1b:3900)
----
Manual Page -- https://php.net/manual/en/function.echo.php
Edit        -- https://main.php.net/note/edit/130356
Del: integrated  -- https://main.php.net/note/delete/130356/integrated
Del: useless     -- https://main.php.net/note/delete/130356/useless
Del: bad code    -- https://main.php.net/note/delete/130356/bad+code
Del: spam        -- https://main.php.net/note/delete/130356/spam
Del: non-english -- https://main.php.net/note/delete/130356/non-english
Del: in docs     -- https://main.php.net/note/delete/130356/in+docs
Del: other reasons-- https://main.php.net/note/delete/130356
Reject      -- https://main.php.net/note/reject/130356
Search      -- https://main.php.net/manage/user-notes.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.