Jump to content

Recommended Posts

Posted

Hello All:

in Killer php Advance php cc (17 videos) in Dispatching Requests to Multiple Controllers . John lebensold teach the follwing switch :

switch($uri)

{

case "/";

case "index";

$controller = new Controllers\IndexController();

break;

case "/test":

$controller = new Controllers\TestController();

 

break;

 

}

 

But I encounter a problem , when I tes http://killerphp or http://killerphp/test , the browser shows nothing , because it doesn't know to call dispatch() method in each controller , then I try to call each controller dispatch method as below :

switch($uri)

{

case "/";

case "index";

$controller = new Controllers\IndexController();

$controller->dispatch($uri);

break;

case "/test":

$controller = new Controllers\TestController();

$controller->dispatch($uri);

break;

 

}

then it works . and the controller works . Mr Jon Lebensold use the first switch .would you please discuss what is the problem

Sincerely yours

  • 3 weeks later...
Guest phpNoob
Posted

Anyone figured out the solution? I am still having this issue....

  • 3 months later...
Posted

Old post I know but no one else commented on it, basically the line below is added after the switch but you cannot see it on the screen.

 

$controller->dispatch($uri);

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...