Jump to content

problem with echo $uri; and var_dump($controller)


karam

Recommended Posts

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

Link to comment
Share on other sites

  • 5 months later...
  • 10 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...