Update once a day and retrieve different categories in a cycle of three days. This post was last edited by AspDelphi at 11:34:01
Import rules: the following 10 sets of datasets with the highest clicks in China and Japan are retrieved in a cycle every three days and updated every day.
Retrieval Category:
Street shot for fashion luxury character life
Beauty and wedding star Test Gallery
Cosmetic trial Brand
Shopping Guide
Gallery below
Reply to discussion (solution)
If you don't understand the difficulties, you can filter the records in the past three days from the database at a scheduled time every day.
There are many solutions for time problems. for example, if you set a start date and compare it with the existing date, you can get the current date within the three-day cycle, then query between and.
$ S = strtotime ('2017-06-15 00:00:00 ');
$ E = time ();
$ Arr = array (
'2014 3 ', // fashion 3
'2017 4', // luxurious, 6
'1970 5', // character, 9
'1970 4', // Life, 12
'100 0', // street shot, 15
'1970 2', // beauty, 18
'1970 3', // star,
'1970 7', // test,
'2014 8', // image library,
'1970, 104,212 ', // cosmetic,
'1970 2', // trial,
'100 0', // brand,
'1970 7', // show,
'1970 2', // shopping guide
); // 42
$ Days = floor ($ e-$ s)/(24*60*60); // get the number of days from today until the first time my program was executed
$ Key = floor ($ days/3); // when the value of $ key exceeds 42 days, it is incorrect.
How can I get this $ key?
$ Arr [$ key] this is the category I want to obtain on the day.
That is to say, your program has been okay, but when it exceeds 42 days, there will be a problem, right?
Then you
$ Days = floor ($ e-$ s)/(24*60*60); // get the number of days from today until the first time my program was executed
$ Key = floor ($ days/3); // when the value of $ key exceeds 42 days, it is incorrect.
Add one
$ Days = fmod ($ days, count ($ arr) * 3 );
$ Days = floor ($ e-$ s)/(24*60*60 )); // Obtain the number of days from today to my first program execution $ days = fmod ($ days, count ($ arr) * 3 ); // $ days is always less than the number of days in a loop $ key = floor ($ days/3); // when the number of days exceeds 42, the $ key value is incorrect.
If the problem persists or the problem persists