1 Star 0 Fork 8

尹上华/SlimCustom

forked from Jing/SlimCustom 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Demo.php 950 Bytes
一键复制 编辑 原始数据 按行查看 历史
Jing 提交于 2017-07-03 15:19 +08:00 . no message
<?php
/**
* @package Demo.php
* @author Jing Tang <tangjing3321@gmail.com>
* @link http://www.slimphp.net/
* @version 2.0
* @copyright Copyright (c) http://www.slimphp.net
* @date 2017年6月7日
*/
$application = require __DIR__ . '/../../SlimCustom/index.php';
$application->setName('Demo')->setPath(realpath(__DIR__ . '/../'))->boot();
$daemon = Daemon();
$daemon->group('Demo', function () {
// 注册任务‘task1’,每隔10秒运行
$this->call(10, 'task1', function () {
while (true) {
logger()->info(getmypid());
sleep(1);
}
//sleep(10);
exit;
});
// 注册任务‘task2’,每隔5秒运行
$this->call(5, 'task2', function () {
while (true) {
logger()->info(getmypid());
sleep(1);
}
//sleep(5);
exit;
});
});
// 启动任务调度守护进程
$daemon->run();
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/yinshanghua/SlimCustom.git
git@gitee.com:yinshanghua/SlimCustom.git
yinshanghua
SlimCustom
SlimCustom
master

搜索帮助