uTools-Manuals/docs/php/pcntl_signal_get_handler.html
2019-04-28 19:00:34 +08:00

109 lines
5.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Get the current handler for specified signal</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.pcntl-signal-get-handler" class="refentry">
<div class="refnamediv">
<h1 class="refname">pcntl_signal_get_handler</h1>
<p class="verinfo">(PHP 7 &gt;= 7.1.0)</p><p class="refpurpose"><span class="refname">pcntl_signal_get_handler</span> &mdash; <span class="dc-title">Get the current handler for specified signal</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.pcntl-signal-get-handler-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>pcntl_signal_get_handler</strong></span>
( <span class="methodparam"><span class="type">int</span> <code class="parameter">$signo</code></span>
) : <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span></div>
<p class="para rdfs-comment">
The <span class="function"><strong>pcntl_signal_get_handler()</strong></span> function will get the current handler for the specified <code class="parameter">signo</code>.
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.pcntl-signal-get-handler-parameters">
<h3 class="title">参数</h3>
<dl>
<dt>
<code class="parameter">signo</code></dt>
<dd>
<p class="para">
The signal number.
</p>
</dd>
</dl>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.pcntl-signal-get-handler-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
This function may return an integer value that refers to <strong><code>SIG_DFL</code></strong> or <strong><code>SIG_IGN</code></strong>. If you set a custom handler a string value containing the function name is returned.
</p>
</div>
<div class="refsect1 changelog" id="refsect1-function.pcntl-signal-get-handler-changelog">
<h3 class="title">更新日志</h3>
<table class="doctable informaltable">
<thead>
<tr>
<th>版本</th>
<th>说明</th>
</tr>
</thead>
<tbody class="tbody">
<tr>
<td>7.1.0</td>
<td>
<span class="function"><strong>pcntl_signal_get_handler()</strong></span> has been added.
</td>
</tr>
</tbody>
</table>
</div>
<div class="refsect1 examples" id="refsect1-function.pcntl-signal-get-handler-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-4327">
<p><strong>Example #1 <span class="function"><strong>pcntl_signal_get_handler()</strong></span> example</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">pcntl_signal_get_handler</span><span style="color: #007700">(</span><span style="color: #0000BB">SIGUSR1</span><span style="color: #007700">));&nbsp;</span><span style="color: #FF8000">//&nbsp;Outputs:&nbsp;int(0)<br /><br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">pcntl_test</span><span style="color: #007700">(</span><span style="color: #0000BB">$signo</span><span style="color: #007700">)&nbsp;{}<br /></span><span style="color: #0000BB">pcntl_signal</span><span style="color: #007700">(</span><span style="color: #0000BB">SIGUSR1</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'pcntl_test'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">pcntl_signal_get_handler</span><span style="color: #007700">(</span><span style="color: #0000BB">SIGUSR1</span><span style="color: #007700">));&nbsp;</span><span style="color: #FF8000">//&nbsp;Outputs:&nbsp;string(10)&nbsp;"pcntl_test"<br /><br /></span><span style="color: #0000BB">pcntl_signal</span><span style="color: #007700">(</span><span style="color: #0000BB">SIGUSR1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">SIG_DFL</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">pcntl_signal_get_handler</span><span style="color: #007700">(</span><span style="color: #0000BB">SIGUSR1</span><span style="color: #007700">));&nbsp;</span><span style="color: #FF8000">//&nbsp;Outputs:&nbsp;int(0)<br /><br /></span><span style="color: #0000BB">pcntl_signal</span><span style="color: #007700">(</span><span style="color: #0000BB">SIGUSR1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">SIG_IGN</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">pcntl_signal_get_handler</span><span style="color: #007700">(</span><span style="color: #0000BB">SIGUSR1</span><span style="color: #007700">));&nbsp;</span><span style="color: #FF8000">//&nbsp;Outputs:&nbsp;int(1)<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
</div>
</p>
</div>
<div class="refsect1 seealso" id="refsect1-function.pcntl-signal-get-handler-seealso">
<h3 class="title">参见</h3>
<ul class="simplelist">
<li class="member"><span class="function"><a href="pcntl_signal.html" class="function" rel="rdfs-seeAlso">pcntl_signal()</a> - 安装一个信号处理器</span></li>
</ul>
</div>
</div></div></div></body></html>