Hi, I am working on a Phalcon project. I can execute all my controller and action by giving the/controllername/actionname
in url. The routes which I have added using the Router class are not working.
As per below router, https://localhost/myproject/api/list
must load the controller 'Clients' and the action 'index'.
$router = new \Phalcon\Mvc\Router();
$router->add(
"/api/list",
array(
"controller" => "Clients",
"action" => "index",
)
);
$router->handle();
I added the following lines below the $router->handle();
echo '<br />';
echo 'Controller: '. $router->getControllerName();
echo '<br />';
echo 'action: ' . $router->getActionName();
echo '<br />';
It gives me the output
Controller: Clients
action: index
But at the end of the page I am getting,,
ApiController handler class cannot be loaded
The framework still trying to load the controller Api
with action name list
directly from URL which doesn't exist.