I need to make my file that makes the instance of my project classes work on both the web server and the local server.
This is the file that makes autoload, autoload.php
<?php
spl_autoload_register ( function ($classe){
$classesDiretorio = __DIR__.'/classes/';
$classesArquivo = $classesDiretorio . ' / ' . $classe . '.php';
if(file_exists($classesArquivo)){
require_once ($classesArquivo)
}
});
In xampp, it works fine, but when I upload to the site, it gives an error in the path address.
The following is the error:
Fatal error: Class 'Client' not found in /home/diego325/public_html/temporary/rental/cadastro.php online 13
How can I make autoload take paths both on the local server and on the web server?
I think my problem looks like this:
But in the problem mentioned above there was no solution.