1. Create the demo.php demo file code as follows:
<? PHP Echo Rand (1,99999). Php_eol; // generate a different number each time
2.linux crontab Execution
3. Go to crontab edit to add the
* * * * * * php/var/html/demo.php >>/var/www/html/demo. Log // The above code indicates that the demo.php is executed once per minute and the output record is saved to Demo.log//The first * indicates the Minutes//the second * indicates the hour//the third * indicates the day//fourth * indicates the month//fifth * represents the week//every morning 6 points//0 6 * * Every two hours//0 */2 * * *//night 11 o'clock to 8 a.m. every two hours and morning eight o '//0 23-7/2,8 * * *//4th number per month and Monday to Sunday three morning 11//0 4 * 1-3 C//1 month 1st morning 4/ /0 4 1 1 *
Tip: If there are 2 scheduled tasks that need to be executed in the editor, write a
Finally, here's a:
Linux timed execution PHP code-timing Plan Crontab