So, I have a directory, called "images". Within that directory, I have a bunch of folders containing images. I would like a PHP array of the names of those folders.
One hiccup: I also have one "includes" folder in the directory which I don't want in the array.
If it helps, the folders I want all have the same "date_filenumber" ("YYYYMMDD_1234") naming patttern, which of course "includes" does not.
I plan to select one of the images at random to display on my landing page.
Please correct me if I'm wrong, but my understanding is that all I need is:
*PHP*
$array = [whatever gets me the list mentioned above]
$random = array_rand($array)
*HTML*
<img src="<?php echo 'images/'.$random.'0x.jpg';?>">
Thanks!
Aucun commentaire:
Enregistrer un commentaire