I have main index.php file where i call other controllers and that is fine.
I call them with call_user_func_array([$object, $this->method], $this->params);
For example i first include controller and then i call it. My controller is called IndexController and this is example how i include it and call it.
IndexController.php
<?php
class IndexController extends Controller {
function __construct()
{
print 'welcome to oxbir'."<BR>";
}
function index()
{
$this->view('panel/user');
}
}
Controller.php
<?php
class Controller
{
function __construct()
{
}
function view($view)
{
include('views/'.$view.'.php');
}
}
but I see this error...
Fatal error: Class 'Controller' not found in C:\xampp\htdocs\site\php\controllers\IndexController.php on line 3
include
orrequire
the files where the required class is defined. So youindexController.php
needsrequire("Controller.php");
at the begin. – Kryptur