gpt4 book ai didi

magento - Magento 最早调度的事件是什么?

转载 作者:行者123 更新时间:2023-12-02 13:09:01 25 4
gpt4 key购买 nike

当客户访问前端 Controller 时,我需要在调度过程中尽早触发一个事件。该请求将被分析,并且可能会被重定向到不同的 URL,从而证明“尽早”的要求是合理的。

开发者最早可以订阅的事件是什么?

最佳答案

我最早依赖的事件是

controller_front_init_before 

Magento 前端 Controller 对象(与“index.php 前端 Controller ”不同)是管理路由器的对象,而路由器又管理操作 Controller 调度。

还有其他一些(resource_get_tablenamecore_collection_abstract_load_beforecore_collection_abstract_load_after)之前触发过,但它们更多的是副作用品种( Magento 使用它自己的系统来引导自身)而不是您想要依赖的任何东西。

最后,正如应该始终指出的那样,如果您在 app/Mage.php 中进行一些日志记录

public static function dispatchEvent($name, array $data = array())
{
file_put_contents('/tmp/events.log',"$name \n",FILE_APPEND);
Varien_Profiler::start('DISPATCH EVENT:'.$name);
$result = self::app()->dispatchEvent($name, $data);
#$result = self::registry('events')->dispatch($name, $data);
Varien_Profiler::stop('DISPATCH EVENT:'.$name);
return $result;
}

模式开始出现。

关于magento - Magento 最早调度的事件是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6410410/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com