PHP code example of davidyan / asyntask

1. Go to this page and download the library: Download davidyan/asyntask library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

davidyan / asyntask example snippets



$task = new AsynTask\Task();

//添加单次任务
$name = '单次任务';
$cmd = 'php abcd.php';
$params = array(
	'params'=>1
);
$task->add_once_task($name,$cmd,$params);

$name = '周期任务';
$cmd = 'php abc.php';
$params = array(
	'params'=>1
);
$timeOptions = array(
	'day'=>1,
	'hour'=>2,
	'minute'=>3
);
$task->add_loop_task($name,$cmd,$params,$timeOptions);