1.31 bytes PHP Random display avatar
2.
$url = ' pic ';
Image address, with relative path
$files =array ();
if ($handle =opendir ("$url")) {
while (false!== ($file = Readdir ($handle))) {
if ($file! = "." && $file! = "...") {
if (substr ($file, -3) = = = ' gif '
substr ($file, -3) = = ' jpg ') $files [Count ($files)] = $file;
}
}
}
Closedir ($handle);
$random =rand (0,count ($files)-1);
if (substr ($files [$random],-3) = = ' gif ') header ("Content-type:image/gif");
ElseIf (substr ($files [$random],-3) = = ' jpg ') header ("Content-type:image/jpeg");
ReadFile ("$url/$files [$random]");
?>
http://www.bkjia.com/PHPjc/314683.html www.bkjia.com true http://www.bkjia.com/PHPjc/314683.html techarticle 1.31 bytes php randomly displayed avatar? ReadFile (rand (0,5). JPG ');? 2. php $url = ' pic '; Image address, with relative path $files =array (); if ($handle =opendir ("$url")) {while (false!== ($file ...