There is a URL: http: // localhost / page / example / edit / 123 actually, how to get the string values correctly: page / example / edit / 123 First thing that comes to mind: $variables = explode('/', $this->request->get('_url'));
but in my opinion to address through the keys is not very convenient ...
Tried through routing, but the variables that I specify there can not get. Example: index.php:
$router->add("/([az])/([az])/([az])/([0-9])", array( "controller" => "myController", "action" => "my", "var1" => 3, "var2" => 4, ) ); $router->handle();
Well, the controller code: myController.php:
public function myAction() { echo 'Зачение: '.$this->dispatcher->getParam("var1"); $this->view->disable(); }
As a result, displays:
Zacheniye:
although I need to display: Meaning: edit Actually, how to be? How easier is it to parse the URL