test.php 347 B

12345678910111213141516
  1. <?php
  2. use Workerman\Worker;
  3. require __DIR__ . '/../vendor/autoload.php';
  4. use Workerman\Crontab\Crontab;
  5. $worker = new Worker();
  6. $worker->onWorkerStart = function () {
  7. // Execute the function in the first second of every minute.
  8. new Crontab('1 * * * * *', function(){
  9. echo date('Y-m-d H:i:s')."\n";
  10. });
  11. };
  12. Worker::runAll();