I'd need to display randomly 4 images from a folder, between each image I need to insert some HTML code.
I already use a PHP function that displays 1 image randomly.
<?php
function RandImg($dir)
{
images = glob(dir. '*.{JPG, jpg, jpeg, png, gif}', GLOB_BRACE);
RandomImage = images[array_rand($images)];
return $randomImage;
}
$the_images = RandImg('assets/upload/pln/photo_menu_aleatoire/');
ImageWithLink = ''.the_images.'';
echo $ImageWithLink;
So I'd like to be able to do the same but with 4 random images:
echo $ImageWithLink1;
some HTML code
echo $ImageWithLink2;
some HTML code
echo $ImageWithLink3;
some HTML code
echo $ImageWithLink4;
some HTML code ```
Aucun commentaire:
Enregistrer un commentaire