Requests_Hooks::register()
最后更新于:2021-11-26 03:04:29
Requests_Hooks::register( string$hook, callback$callback, int$priority)Register a callback for a hook
参数
- $hook
-
(string) (Required) Hook name
- $callback
-
(callback) (Required) Function/method to call on event
- $priority
-
(int) (Required) Priority number. <0 is executed earlier, >0 is executed later
源文件
文件: gc-includes/Requests/Hooks.php
public function register($hook, $callback, $priority = 0) {
if (!isset($this->hooks[$hook])) {
$this->hooks[$hook] = array();
}
if (!isset($this->hooks[$hook][$priority])) {
$this->hooks[$hook][$priority] = array();
}
$this->hooks[$hook][$priority][] = $callback;
}