Created
May 13, 2023 17:56
-
-
Save iconte/b8868df56d97701a5811fb3cab9bc277 to your computer and use it in GitHub Desktop.
autoload exemplo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spl_autoload_register( | |
function (string $namespaceClasse): void { | |
$caminho = “/src”; | |
$diretorio_classe = str_replace("\\", DIRECTORY_SEPARATOR, $namespaceClasse); | |
@include_once getcwd() . $caminho . DIRECTORY_SEPARATOR . "{$diretorio_classe}.php"; | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment