手机
当前位置:查字典教程网 >编程开发 >php教程 >随机头像PHP版
随机头像PHP版
摘要:1.31字节PHP随机显示头像2.

1.31字节PHP随机显示头像

<?readfile(rand(0,5).'.jpg');?>

2.

<?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);

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]");

?>

【随机头像PHP版】相关文章:

PHP出错界面

PHP中的魔术方法总结和使用实例

随机广告显示(PHP函数)

php查询whois信息的方法

开发大型PHP项目的方法

无数据库的详细域名查询程序PHP版(3)

多重條件組合查詢(一)

论坛头像随机变换代码

php实现随机显示图片方法汇总

php函数重载的替代方法

上一篇: 1.PHP简介
精品推荐
分类导航