Answer the question
In order to leave comments, you need to log in
How to define a route in Phalcon if the routing is dynamic?
Hello everyone again.
There was a question on routing in Phalcon. I need to make a non-standard route:
dd.lo/profile/UserName
By default, the UserName method is called. But it is necessary that UserName be a parameter of the profile method of the UserController.php controller.
The documentation describes:
<?php
// Создание маршрутизатора
$router = new Phalcon\Mvc\Router();
// Определение правила маршрутизации
$router->add(
"/admin/users/my-profile",
array(
"controller" => "user",
"action" => "profile"
)
);
$router->handle();
<?php
try
{
/*
My code...
*/
$application = new \Phalcon\Mvc\Application($di);
echo $application->handle()->getContent();
}
catch (Exception $e)
{
echo 'PhalconException: ', $e->getMessage();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question