For the strtotime issue, I 'd like to think of a loop, that is, a day is automatically subtracted from each cycle based on the current date, such as PHPcodefor ($ i0; $ I & lt; 10; $ I ++) {$ current_datedate (& quot; Y-m-d & quot;, strtotime (& quot;-$ iday & quot ;));} this does not seem to work! I want to automatically generate a current date to solve the number of strtotime problems.
Ladies and gentlemen
I want to get a cycle, that is, according to the current date, each cycle is reduced by one day, for example
PHP code
For ($ I = 0; $ I <10; $ I ++) {$ current_date = date ("Y-m-d ", strtotime ("-$ I day "));}
This does not seem to work!
I want to automatically generate a current date to facilitate data query in the database by date.
Or do you have any other solutions?
Thank you!
------ Solution --------------------
PHP code
/* No problem. 2012-02-282012-02-272012-02-262012-02-02-252012-02-242012-02-02-232012-02-222012-02-212012-02 -202012-02-19 */for ($ I = 0; $ I <10; $ I ++) {$ current_date = date ("Y-m-d", strtotime ("-$ I day"); echo $ current_date.'
';}