2012-10-11 46 views
0

如何在URL中實現「slug」(我相信是正確的術語)?說的網址是在Magento中實現URL slugs

www.example.com/module/controller/action1/123 

www.example.com/module/controller/action1/123/abc 

,我想我的action1控制器的操作方法打,我希望能夠訪問值123,甚至123abc,我怎麼可能去做?

回答

0
public function action1Action() 
{ 
    $request = $this->getRequest(); 
    $data = $request->getParams(); 
    var_dump($data); 
} 
0

Magento會用接下來的計劃訪問值U​​RL(除了正常的GET請求):

www.example.com/module/controller/action1/[key]/[value]/[key2]/[value2] 

在控制器方法action1Action您將使用

$value1 = $this->getRequest()->getParam('[key1]'); // [value1] 
$value2 = $this->getRequest()->getParam('[key2]'); // [value2]