pcntl_signal_get_handler Get the current handler for specified signal

发表日期:2021-07-01 08:56:16 | 来源: | | 浏览(461) 分类:PCNTL 函数

pcntl_signal_get_handler

(PHP 7 >= 7.1.0, PHP 8)

pcntl_signal_get_handlerGet the current handler for specified signal

说明

pcntl_signal_get_handler(int $signo): mixed

The pcntl_signal_get_handler() function will get the current handler for the specified signo.

参数

signo

The signal number.

返回值

This function may return an integer value that refers to SIG_DFL or SIG_IGN. If you set a custom handler a string value containing the function name is returned.

更新日志

版本 说明
7.1.0 pcntl_signal_get_handler() has been added.

范例

示例 #1 pcntl_signal_get_handler() example

<?php 
var_dump(pcntl_signal_get_handler(SIGUSR1));
 // Outputs: int(0)function pcntl_test($signo) {
}
pcntl_signal(SIGUSR1, 'pcntl_test');
var_dump(pcntl_signal_get_handler(SIGUSR1));
 // Outputs: string(10) "pcntl_test"pcntl_signal(SIGUSR1, SIG_DFL);
var_dump(pcntl_signal_get_handler(SIGUSR1));
 // Outputs: int(0)pcntl_signal(SIGUSR1, SIG_IGN);
var_dump(pcntl_signal_get_handler(SIGUSR1));
 // Outputs: int(1)?>

参见

集速网 copyRight © 2015-2022 宁ICP备15000399号-1 宁公网安备 64010402001209号
与其临渊羡鱼,不如退而结网
欢迎转载、分享、引用、推荐、收藏。