SpriteWood everybody is one single tree

Rand() for images

Tuesday, June 3rd, 2008

<?php
echo rand(0, 5);
?>

rand这玩意可以用来生成指定范围内的随机数or字符,于是可以拿来做随机展示图片

<?php
$domain = ‘http://www.fouland.com/’;
echo $domain;
echo ‘<img src="’ . $domain . ‘/Path/currentName’ . rand(0, 5) . ‘.gif"’;
?>

Tags:

Posted in php | No Comments »> >
  • Categories

  • Recent Posts

  • Recent Comments

  • SpriteWood is proudly powered by WordPress
    Entries (RSS) and Comments (RSS).