$controller = 'DefaultController';
require('app/controllers/'.$controller.'.php');
$object = new $controller;
This is failing at the new $controller
, but not at the require
.. I really have no ideas here
Fatal error: Class 'DefaultController' not found in C:\wamp\www\controller\index.php on line 31
app/controllers/DefaultController.php
<?php
namespace App\Controllers;
/**
* DefaultController
*/
class DefaultController
{
public function __construct()
{
# code...
}
public function index() {
}
}
edit: I've added the namespace, still the same result
$controller = 'DefaultController';
require('app/controllers/'.$controller.'.php');
$controller = 'App\Controller\\'.$controller;
$object = new $controller;
Fatal error: Class 'App\Controller\DefaultController' not found in C:\wamp\www\controller\index.php on line 33
edit 2: ah yes.. it's Controllers not Controller