Problem to instantiate class

0

I'm creating an MVC application where there is dependency injection to instantiate the classes with connection to the database, the problem happens when I upload the application to a remote server, when I try to access I get the following error "Uncaught Error: Class '\ App \ Models \ Records' not found in ..."

The error itself is in the Container.php file

namespace SON\DI;

    class Container
    {
        public static function getClass($name)
        {
            $str_class = "\App\Models\".ucfirst($name);
            $class = new $str_class(\App\Init::getDb());
            return $class;
        }
    }

It is called in the SubmissionController class

$registros = \SON\DI\Container::getClass("Registros");

Also follows the class Register.php analogous to all other Model classes that would use the Injection

namespace App\Models;

class Registros {

    protected $db;

    public function __construct (\PDO $db)
    {
        $this->db = $db;
    }

The curious thing is that the code works in place but it is not working on the host, I've already reviewed forums but I did not get an answer.

    
asked by anonymous 30.10.2018 / 21:07

1 answer

0

The code contained in .htacess is

RewriteEngine On

RewriteCond %{REQUEST_URI} !^public [OR] RewriteCond %{REQUEST_FILENAME} !-s [OR] RewriteCond %{REQUEST_FILENAME} !-l [OR] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !.(?:css|js|jpe?g|gif|png)$ [NC] RewriteRule ^.*$ public/index.php [NC,L]

    
26.11.2018 / 01:27