Insert “element” among other “elements” of the array (loop) php

后端 未结 3 1061
遥遥无期
遥遥无期 2021-01-29 11:35

my code causes the images to appear randomly within the page. But how to insert an \"element\" (in my case would be a div) between these images?



        
3条回答
  •  忘掉有多难
    2021-01-29 12:21

    If you want to add a div(content) between those two pairs of images - add additional condition into your loop:

    ...
    for ($i=0; $i<4; $i++) {
        if ($i == 1) echo '
    some content ...
    '; echo ''; }

提交回复
热议问题