I have the following file index.php
<?php
require_once 'global/erros/erros.ini';
require_once 'vendor/autoload.php';
use CLASSES\INIT\Init;
new Init();
?>
And the following class Init.php
<?php
namespace CLASSES\INIT;
use CLASSES\CONFIG\Config;
class Init extends Config {
protected function iniciaRotas() {
$ar["home"] = array("rota"=>"/crud/", "controle"=>"site", "acao"=>"index");
$ar["index"] = array("rota"=>"/crud/index", "controle"=>"site", "acao"=>"index");
$ar["admin"] = array("rota"=>"/crud/admin", "controle"=>"admin", "acao"=>"index");
$this->configRotas($ar);
}
}
?>
And the following autoload_ps4
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'CLASSES\' => array($baseDir . '/classes'),
);
So, locally (localhost) works.
But when I upload to the server it gives an error:
Fatal error: Class 'CLASSES\INIT\Init' not found in
/var/www/html/funerariasaopedro.net.br/web/crud/index.php on line 8
It does not make much sense!
Tree
\
\index.php
\classes\
\classes\init\
\classes\init\Init.php
How did I stop at composer.json
to generate autoload_psr4.php
?
In this way:
'CLASSES\UTIL\' : '/classes/util',
'CLASSES\MVC\CONTROLES\' : '/classes/mvc/controles'
Or this?
'CLASSES\UTIL\Util\' : '/classes/util/Util.php',
'CLASSES\MVC\CONTROLES\Administradores\' : '/classes/mvc/controles/Administradores.php',
'CLASSES\MVC\CONTROLES\Base\' : '/classes/mvc/controles/Base.php'