略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: win32service 函数

2024-04-16

win32service 函数

目录

add a noteadd a note

User Contributed Notes 1 note

up
1
brian dot ngure at gmail dot com
12 years ago
An example of how it should be done:

<?php

class TestClass {
    private
$args;

    function
__construct($arg) {
       
$this->args = $arg;
       
$this->run();
    }

    private function
run() {
        if (
$this->args == 'run') {
           
win32_start_service_ctrl_dispatcher('test_service');

            while (
WIN32_SERVICE_CONTROL_STOP != win32_get_last_control_message()) {
               
# do your work here.
                # try not to take up more than 30 seconds before going around the loop
                # again
           
}
        }
    }
}

$object = new TestClass($argv[1]);

?>

官方地址:https://www.php.net/manual/en/ref.win32service.php

冷却塔厂家 广告
-- 广告
北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3