php generate random image from a directory

后端 未结 4 1312
轻奢々
轻奢々 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条回答
  •  心在旅途
    2020-12-21 10:03

    Here's my answer, which seems to work OK. It produces one image generated randomly from the images in a given folder:

    
    " />
    

提交回复
热议问题