Magento: How to get controller, module, action and router name?

参考案例:http://blog.chapagain.com.np/magento-how-to-get-controller-action-and-module-name-in-template-file/

magento获取Module、Con他roller、Action 等 都在app/code/core/Mage/Core./Controller/Request/Http.php文件里面,例如:

获取模块名称:

$module = $this->getRequest()->getModuleName(); 

获取控制器名称:

 $controller = $this->getRequest()->getControllerName();

获取方法名称:

$action     = $this->getRequest()->getActionName()."<br>";

总结: 要想获取http.php中的函数,参考方法: $this->getRequest()->fun();

Leave a comment

您的电子邮箱地址不会被公开。 必填项已用*标注