I need to make a dynamic namespace: [module]\controller\[controller]Controller, but the follow code does not work:
$namespace = '\Account\Controller\LoginController()';
new $namespace;
Like this:
new \Account\Controller\LoginController();
What I forgot?
Don’t add the
()to the string. The()are used when calling the function, not in its name.If you want to pass params, add the
()to thenewcall.