Thinkphp 3.2.3 Specific implementation examples of scheduled Tasks tutorial

Source: Internet
Author: User

Thinkphp 3.2.3 Specific implementation examples of scheduled Tasks tutorial

In many cases, our site will be used to schedule tasks that are scheduled updates to do some processing, similar to the discuz background of the scheduled tasks, such as updating the number of daily posts and so on!

TP is also possible here, first in the application public configuration directory under the new crons.php, write:

<?phpreturnarray(‘cron_1‘=> array(‘Uploads‘, 1),//行为扩展);

Parameter description:

‘cronname‘=>array(‘filename‘,intervals,nextruntime),//cronname是任务名filename是任务文件名intervals间隔时间nextruntime下次执行时间

Then also create a new tags.php in the application public configuration directory, write:

<?phpreturnarray(‘app_end‘=> array(‘Behavior\CronRunBehavior‘),);

Then in the application public directory to create a new cron directory, the user to hold some of the specific operation of the task code, as above in the Cron directory in the new uploads.php file for processing cron_1 this scheduled task processing!

Note that this is written in a public profile, and if you want to perform this scheduled task separately for a group, you can write it in a grouped profile!

Thinkphp 3.2.3 Specific implementation examples of scheduled Tasks tutorial

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.