|
楼主 |
发表于 2007 年 6 月 17 日 08:33:27
|
显示全部楼层
===============
<?=readfile("./img/".rand(1,4).".jpg")?>
===========
上面另存为php文件。传到目录上,在此目录下建个“ img\"文件夹,把1 2 3 4 的jpg 或者 gif 文件放到这里
刷新一次变一个图的代码~~
例子.
http://www.9458.net/f.php?.jpg
http://www.winyi.com/head/index.php?.jpg
第二种:
===================
<?php
$url=\'pic\';
$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);
readfile(\"$url/$files[$random]\");
?>
==================
使用方法:
将此文件放在某目录下,先在控制面板中改你头像图片的地址为此文件地址,然后在该目录下创建目录pic,将所有图片放在目录pic下即可 |
|