This article introduces the example code of using PHP to randomly display images. Friends in need can refer to it.
php random image display code, as follows: <?php /** * 随机显示几张图片 * by bbs.it-home.org */ $resim1="<img src=1.gif alt=Resim_1>"; $resim2="<img src=2.gif alt=Resim_2>"; $resim3="<img src=3.gif alt=Resim_3>"; $resim4="<img src=4.gif alt=Resim_4>"; $resim=array($resim1,$resim2,$resim3,$resim4); shuffle ($resim); echo "<table width=\"445\" height=\"245\" border=\"1\" bordercolor=\"black\"> <tr> <td>"; echo $resim[0]; "</td> <td>"; echo $resim[1];"</td> </tr> <tr> <td>"; echo $resim[2];"</td> <td>"; echo $resim[3];"</td> </tr> </table> "; ?> Copy after login |