Example of php randomly displaying images

WBOY
Release: 2016-07-25 08:55:54
Original
1960 people have browsed it
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
you may also like: php function to randomly display images


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template