-2
You can do this in php
use COntroller;
class Bootstrapp(){
public static function logar(){
$controller=new \Controller\$controlador();
}
I’ve tried it here and the syntax error
down here the code
if (is_readable($caminho)) {
            require $caminho;
            $controlador = ucfirst($controller);
           ( $controller = new \controllers\$controlador;) aqui onde da erro
            if (is_callable(array($controller, $metodo))) {
                $metodo = $pedido->getMetodo();
            } else {
                $metodo = "index";
            }
            if (isset($parametro)) {
                call_user_func_array(array($controller, $metodo), $parametro);
            } else {
                call_user_func(array($controller, $metodo));
            }
        } else {
            header("Location:" . URL . "error");
        }
						
And what are you trying to do to yourself? You can put the code?
– CesarMiguel
There’s something wrong with this "MVC", log in should not be a bootstrap method! Login is a user request and needs logic (model), so it should be a controller.
– Papa Charlie
MVC has nothing to do with autoload php.. I think what you want is to autoload classes with namespace. First try to understand the standards for autoload, see this: http://www.php-fig.org/psr/psr-0/
– Daniel Omine
I read the question five times and I don’t understand what it is you’re trying to do. However, PHP differentiates upper case from lower case in variable name, and port
Controller,COntrollerandcontrollerare different things. Besides, I thinknew \Controller\$controlador();andnew \controllers\$controlador;are not valid syntax.– Victor Stafusa