[Solved] How can i setup my php code to change my CSS background picture daily [closed]


You could either use the day of the week numbers, or day of the month numbers. Anything further than that you’ll probably need a database or a save file or something. This is the simplest way:

//SHOW ONE IMAGE PER DAY OF THE WEEK FOR 7 IMAGES
$dotw = new \DateTime("NOW");
$dotwNum = $dotw->format('w');
echo "<body style="background: url(../../image{$dotwNum}.jpg)"></div>";

//SHOW ONE IMAGE PER DAY OF THE MONTH FOR 30 IMAGES
$dotm = new \DateTime("NOW");
$dotmNum = $dotw->format('j');
echo "<body style="background: url(../../image{$dotmNum}.jpg)"></div>";

1

solved How can i setup my php code to change my CSS background picture daily [closed]