PHP triggered task execution solution

Source: Internet
Author: User
PHP triggered task execution is like this. how can I enable PHP to execute a specific code when the first person accessing the website on the first day of every month does not work until the first day of the next month, the first visitor executes the specific code again. as long as the visitor records on the first day of each month are written into the data table, the visitor records cannot be determined ., When fn { 'no_start.txt 'PHP triggered execution task
The problem is.
How can I enable PHP to execute a specific code when the first person accessing the website on the first day of every month fails to access the website,
Until No. 1 in next month, the first visitor will execute the specific code again.
------ Solution --------------------
If you write visitor records to the data table for users on the first day of each month, you can determine if the visitor records are correct.
------ Solution --------------------
$ Fn = 'no_start.txt ';
If (! File_exists ($ fn)
------ Solution --------------------
Date ('D', filemtime ($ fn ))! = 1 ){
Echo 'execute a specific code ';
File_put_contents ($ fn ,'');
}

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.