Jump to content

Recommended Posts

Posted

use \com\killerphp\controllers as Controllers;

 

 

 

$uri = strtolower($_SERVER['REQUEST_URI']);

 

list($pfx, $controllerName,$actionName) = preg_split('/[\/\\\]/',$uri);

echo $uri;

 

switch($controllerName)

{

case "":

case "index":

$controller = new Controllers\IndexController($controllerName,$actionName);

break;

case "test":

$controller = new Controllers\TestController($controllerName,$actionName);

break;

}

var_dump($controller);

$controller->dispatch();

 

output is

 

/public/

 

Notice: Undefined variable: controller in C:\xampp\htdocs\public\index.php on line 35

NULL

Notice: Undefined variable: controller in C:\xampp\htdocs\public\index.php on line 36

 

Fatal error: Call to a member function dispatch() on a non-object in C:\xampp\htdocs\public\index.php on line 36

 

 

 

I 'm watching kp3-setting-up-htaccess-for-controllers this video and try to do myself in window 7 laptop . my question is i save C:\xampp\htdocs\public .htaccess and show output /public/ and also undefined variable controller ??

 

any body guide me to solve this problem then i move foward..... advance thankx

  • 5 months later...
Posted

Same problem for me. When i add $controller->dispatch($uri) to index.php on "Dispatching request to multiple controllers lesson"; i get the same errors (Undefined variable $controller and Call to a member function dispatch() on a non-object in)

  • 10 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...