[PicBar]刷新换图 PHP代码 刷新一次 换一次图片

Snow 撰写  


我把标题栏的图变成可以刷新换图的啦~ 哈哈~ 都有上面这三个图,(*^__^*) 嘻嘻……以后会多做一点。

<?php
$url=’bar’;
$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]“);

?>

把这个段代码直接保存为bar.php
同时建一个文件夹为bar.当然你也可以改成别的,但是必须与文件里面的url统一.
图片地址写http://你的网址/bar.php 就可以啦。

3 条评论

  1. 发表了 2008-08-06 在 17:37 | 永久链接 | Reply

    iamheretotellyouastorythatiloveu

  2. 发表了 2008-08-06 在 17:41 | 永久链接 | Reply

    Really? do you know me?

  3. 发表了 2008-08-26 在 06:49 | 永久链接 | Reply

    :08:

发表评论

Your email is never shared.

:13: :12: :11: :10: :09: :08: :07: :05: :04: :02: :01: :00: