手机
当前位置:查字典教程网 >编程开发 >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版(5)

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

PHP面向对象之后期静态绑定功能介绍

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

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

虚拟主机中对PHP的特殊设置

PHP入门速成(3)

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