How to implement random image display in a for loop in PHP
P粉852578075
P粉852578075 2023-09-02 10:19:10
0
1
402
<p>I have a simple web page where I am trying to echo multiple images, my code is as follows</p> <p> <pre class="brush:html;toolbar:false;"><?php for($l=1;$l<=45;$l ){?> <div class="thumb" style="background-image: url(l<?=$l?>.jpg);"></div> <?php } ?></pre> </p> <p>So the pictures here are displayed in order from 1 to 45, but I want the pictures to be displayed in a random manner every time the page is loaded, can anyone tell me how to achieve this? Thank you in advance</p>
P粉852578075
P粉852578075

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!