For example, a blog display window
Copy the Code code as follows:
!--? php /**********************************************
* Filename:img.php
* Author: Freemouse
* Web:www.cnphp.info
* email:freemouse1981@gmail.com
* DATE:2010/12/27
* Usage:
*
*
***********************************************/
if ($_get[' folder ') {
$folder =$_get[' folder '];
}else{
$folder = '/images/';
}
//Where the picture file is stored
$path = $_server[' Document_root '). " /". $folder;
$files =array ();
if ($handle =opendir ("$path")) {
while (false!== ($file = Readdir ($handle))) {
if ($file! = "." && $fil E! = "...") {
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 ("$path/$files [$random]");
?>
The above described in Lol re-random PHP random display of the function code, including LOL re-random aspects of the content, I hope to be interested in PHP tutorial friends helpful.