gpt4 book ai didi

php - fatal error :第 62 行调用未定义的方法 Action::execute()/home/public_html/system/engine/event.php

转载 作者:行者123 更新时间:2023-11-29 15:58:46 25 4
gpt4 key购买 nike

您好,尝试刷新 opencart 中的修改缓存,从那时起,我在前端收到一个空白页面,并显示此错误消息。

public function trigger($event, array $args = array()) {
foreach ($this->data as $value) {
if (preg_match('/^' . str_replace(array('\*', '\?'), array('.*', '.'), preg_quote($value['trigger'], '/')) . '/', $event)) {
$result = $value['action']->execute($this->registry, $args);

if (!is_null($result) && !($result instanceof Exception)) {
return $result;
}
}
}
}

谢谢

最佳答案

您的 OC 版本似乎为 3.0.2.x 或更高版本。

在事件类的 $this->data 中,您注册了一个缺少操作参数的事件。

$this->data[] = array(
'trigger' => $trigger,
'action' => $action, // <-- this must be an Action Object with a method execute()
'priority' => $priority
);

所有事件均通过 register() 方法注册,该方法显式请求将 Action 对象作为参数传递。

由于错误指向“调用未定义的方法 Action::execute()”,我可以假设您的操作类存在问题。

您很可能需要检查 system/storage/modifications 中的 system/engine/action.php 文件的修改。

可能是方法 execute() 丢失或以某种方式损坏。

调试

尝试 var_dump $value 以查看其中有什么:

public function trigger($event, array $args = array()) {
foreach ($this->data as $value) {
//log out the $value before the error to see if the Action object is actually there and see what trigger causes this.
var_dump($value);
if (preg_match('/^' . str_replace(array('\*', '\?'), array('.*', '.'), preg_quote($value['trigger'], '/')) . '/', $event)) {
$result = $value['action']->execute($this->registry, $args);

if (!is_null($result) && !($result instanceof Exception)) {
return $result;
}
}
}
}

希望这有帮助

关于php - fatal error :第 62 行调用未定义的方法 Action::execute()/home/public_html/system/engine/event.php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56324444/

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