php generate random image from a directory

后端 未结 4 1300
轻奢々
轻奢々 2020-12-21 09:49

I have to generate random image from a directory. I know which is simple like,

   $dire=\"images/\";
   $images = glob($dire. \'*.{jpg,jpeg,png,gif}\', GLOB_         


        
4条回答
  •  萌比男神i
    2020-12-21 09:56

    One solution might be to do this:

    
    
    

    This will guarantee that you use each image only once, in a random order.

提交回复
热议问题