I have started a zend2 project and I can not understand the routing system. I really need some help getting back to the controller after seeing a few scenes module configuration looks like this:
map' = & gt; array (//) Change this to a specific path for the path '= & gt;' / map [/: action] [/: tileId] ',' defaults' = & gt;; Reflects the namespace in which // is available in your modules Administrator '__NAMESPACE__' = & gt; Map Controller ',' Controller '= & gt;' index ',' Action '=>' index ',),' May_terminate '=>,' child_routes '= & Gt; array (// This path is a sensible def to a module While improving; // As you strengthen routes for your module, however, you can remove it and replace it with more specific channels. 'Default' = & gt; array (' Type '= & gt;' Segment ',' Option '= & gt; array (' path '= & gt;' / [: controller [/: verb]] ',' barriers '= & gt; array (' controller '= & Gt;' [a-zA-Z] [a-zA-Z0-9 _-] * ',' action '=> [[A-ZA-Z] [a-zA-Z0-9] _ '] *',), 'Defaults' => (array),))))))))))),), 'visible_menier' = & gt; Array ('template_path_stack' = & gt; array ('map' = & gt; __DIR__. '/../view',),)));
I have a method 2 method in my controller, where I want to pass the parameter:
public function buyTileAction ($ tileId) {echo $ TileId; }
And likewise, the problem is that I try "myappname.dev/map/buy-tile" and enter this method and for example only one String prints, but when I try to pass a parameter like "Myappname.dev/map/buy-tile/tileId/1" I do not get the value in the controller.
Try it first
:
< Code> $ tile id = $ this- & gt; GetEvent () - & gt; GetRouteMatch) - & gt; GetParam ('tileId');
Comments
Post a Comment