下面附上测试代码

PHP定时任务代码脚本文件

<?php\Swoole\Timer::tick(3000, function (int $timer_id, $param1, $param2) { echo &#34;timer_id #$timer_id, after 3000ms.\n"; echo "param1 is $param1, param2 is $param2.\n"; Swoole\Timer::tick(14000, function ($timer_id) { echo "timer_id #$timer_id, after 14000ms.\n"; });}, "A", "B");

Shell脚本实行PHP定时任务脚本文件

php定时任务PHP剧本履行准时义务的流程实例 CSS

#!/bin/sh# echo "直接韶光开始============`date +%F' '%T`==========="start() { echo "============启动成功==========="}stop() { echo "============停滞成功==========="}restart() { echo "============重启成功==========="}echo -e "===========做事启动命令============ \n \n"echo -e "1:启动做事 2:停滞做事 3:重启做事 0:取消 \n \n"echo -e "=================================== \n \n"read -p "请输入命令编号:" inputText #提示用户输入数字if [ $inputText == 1 ]; then startelif [ $inputText == 2 ]; then stopelif [ $inputText == 3 ]; then restartelif [ $inputText == 0 ]; then echo -e "\n取消操作\n"fi

PHP实行shell脚本文件

<?phpsystem('sh py.sh'); // 实行shell命令