简单PHP随机化器
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了简单PHP随机化器相关的知识,希望对你有一定的参考价值。
Visit the link for instructions on how to use it.
<?php /* Simple randomizer. Roger Johansson, http://www.456bereastreet.com/ */ echo '<ul>' . " "; 'href' => 'url-1', 'title' => 'title-text-1', 'src' => 'image-1.jpg', 'alt' => 'alt-text-1' ), 'href' => 'url-2', 'title' => 'title-text-2', 'src' => 'image-2.jpg', 'alt' => 'alt-text-2' ), 'href' => 'url-3', 'title' => 'title-text-3', 'src' => 'image-3.jpg', 'alt' => 'alt-text-3' ), 'href' => 'url-4', 'title' => 'title-text-4', 'src' => 'image-4.jpg', 'alt' => 'alt-text-4' ), 'href' => 'url-5', 'title' => 'title-text-5', 'src' => 'image-5.jpg', 'alt' => 'alt-text-5' ) ); $numberOfItems = 3; // Change to the number of items you want for ($i = 0; $i < $numberOfItems; $i++) { $item = $arrItems[$randItems[$i]]; echo " " . '<li class="r' . ($i + 1) . '"><a href="' . $item['href'] . '" title="' . $item['title'] . '"><img src="' . $item['src'] . '" alt="' . $item['alt'] . '"></a></li>' . " "; } echo '</ul>' . " "; ?>
以上是关于简单PHP随机化器的主要内容,如果未能解决你的问题,请参考以下文章