在执行请求的控制器的方法之前如何调用方法:magento [英] How to call a method before the method of requested controller is executed : magento
问题描述
我相信我们可以做到这一点,
请提供您的建议。
希望我们可以解决这个问题,或者可能一些专家们已经解决了这个问题。
谢谢。
需要创建一个Observer,绑定到 controller_action_predispatch
事件。这将在Magento代码库中的每个控制器之前触发。这里有一个有用的维基页面,让您了解处理。
I want to call a method before the execution of every and each controller's method. I don't want to go and call the method in every method. I just want to call it from one place and it will be called before any method of any controller in magento.
And I am sure we can do this but I don't know how it can be accomplished.
Please provide your suggestions.
Hope we can resolve this or may some expert guys already resolved this.
Thanks.
You need to create an Observer that binds to the controller_action_predispatch
Event. That will fire before every controller in the Magento codebase. There's a useful wiki page here that walks you through the process.
这篇关于在执行请求的控制器的方法之前如何调用方法:magento的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!