1.根据官方文档安装好workerman,配置好tp6配置文件
2.贴执行文件代码
<?phpnamespace app\http;use think\worker\Server;use Workerman\Lib\Timer;class Haha extends Server{//写一个假的监听地址protected $socket = 'http://127.0.0.1:2347';/** * 每个进程启动 * @param $worker */public function onWorkerStart(){//定时任务Timer::add(1, function () {echo "哈哈";});}}