📄 function.win32-start-service-ctrl-dispatcher.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Registers the script with the SCM, so that it can act as the service with the given name</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.win32-set-service-status.html">win32_set_service_status</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.win32-start-service.html">win32_start_service</a></div> <div class="up"><a href="ref.win32service.html">win32service Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.win32-start-service-ctrl-dispatcher" class="refentry"> <div class="refnamediv"> <h1 class="refname">win32_start_service_ctrl_dispatcher</h1> <p class="verinfo">(No version information available, might be only in CVS)</p><p class="refpurpose"><span class="refname">win32_start_service_ctrl_dispatcher</span> — <span class="dc-title">Registers the script with the SCM, so that it can act as the service with the given name</span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><b><b>win32_start_service_ctrl_dispatcher</b></b></span> ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$name</tt></span> )</div> <p class="para rdfs-comment"> When launched via the Service Control Manager, a service process is required to "check-in" with it to establish service monitoring and communication facilities. This function performs the check-in by spawning a thread to handle the lower-level communication with the service control manager. </p> <p class="para"> Once started, the service process should continue to check-in with the service control manager so that it can determine if it should terminate. This is achieved by periodically calling <a href="function.win32-get-last-control-message.html" class="function">win32_get_last_control_message()</a> and handling the return code appropriately. </p> </div> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><i><tt class="parameter">name</tt></i></span> <dd> <p class="para"> The short-name of the service, as registered by <a href="function.win32-create-service.html" class="function">win32_create_service()</a>. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns <b><tt>TRUE</tt></b> on success, otherwise <b><tt>FALSE</tt></b> or a win32 error code. </p> </div> <div class="refsect1 examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example"> <p><b>Example #1 A <b>win32_start_service_ctrl_dispatcher()</b> example</b></p> <div class="example-contents"><p> Any text that describes the purpose of the example, or what goes on in the example should go here (inside the </p></div> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br /></span><span style="color: #007700">if (!</span><span style="color: #0000BB">win32_start_service_ctrl_dispatcher</span><span style="color: #007700">(</span><span style="color: #DD0000">'dummyphp'</span><span style="color: #007700">)) {<br /> die(</span><span style="color: #DD0000">"I'm probably not running under the service control manager"</span><span style="color: #007700">);<br />}<br /><br />while (</span><span style="color: #0000BB">WIN32_SERVICE_CONTROL_STOP </span><span style="color: #007700">!= </span><span style="color: #0000BB">win32_get_last_control_message</span><span style="color: #007700">()) {<br /> </span><span style="color: #FF8000"># do some work here, trying not to take more than around 30 seconds<br /> # before coming back into the loop again<br /></span><span style="color: #007700">}<br /></span><span style="color: #0000BB">?></span></span></code></div> </div> </div> </p> </div> <div class="refsect1 seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><a href="function.win32-get-last-control-message.html" class="function" rel="rdfs-seeAlso">win32_get_last_control_message()</a></li> </ul> </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.win32-set-service-status.html">win32_set_service_status</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.win32-start-service.html">win32_start_service</a></div> <div class="up"><a href="ref.win32service.html">win32service Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -