日期:2014-05-17 浏览次数:20480 次
$a = base_convert(85,10,4); //85为数字等级
$b = array(1=>'star',2=>'moon',3=>'sun',4=>'crown');
$e = strlen($a);
for($i=0;$i<$e;$i++){
$c = (int)substr($a,$i,1);
if($c>0) for($d=0;$d<$c;$d++) echo '<img src="http://id.qq.com/level/img/'.$b[$e-$i].'.png" />';
}
if(isset($_GET['img'])) {
die(file_get_contents("http://id.qq.com/level/img/$_GET[img].png"));
}
$a = base_convert(85,10,4); //85为数字等级
$b = array(1=>'star',2=>'moon',3=>'sun',4=>'crown');
$e = strlen($a);
for($i=0;$i<$e;$i++){
$c = (int)substr($a,$i,1);
if($c>0) for($d=0;$d<$c;$d++) echo '<img src="?img='.$b[$e-$i].'" />';
}
<?php
function qqdj($nowlevel)
{
/*星星1 月亮4 太阳16 皇冠64 */
$a = $b = $c = $d = 0;
$d = floor($nowlevel/64);
$dj= $nowlevel%64;
$c = floor($dj/16);
$dj = $dj%16;
$b = floor($dj/4);
$a = $dj%4;
return array($a,$b,$c,$d);
}
function qqdjImg($nowlevel)
{
/*星星1 月亮4 太阳16 皇冠64 */
$arrDJ = array();
$arrDJ[] = floor($nowlevel/64);
$dj= $nowlevel%64;
$arrDJ[] = floor($dj/16);
$dj = $dj%16;
$arrDJ[] = floor($dj/4);
$arrDJ[] = $dj%4;
$arrImg = array(
'<img src="http://id.qq.com/level/img/crown.png" />',
'<img src="http://id.qq.com/level/img/sun.png" />',
'<img src="http://id.qq.com/level/img/moon.png" />',
'<img src="http://id.qq.com/level/img/star.png" />',
);
$html = '';
foreach ($arrDJ as $k => $v)
{
$html .= str_repeat($arrImg[$k],$v);
}
print_r($arrDJ);
return $html;
}
$dj = 37;
$dj = 71;
echo qqdjImg($dj);
/*
X-Powered-By: PHP/5.2.0
Content-type: text/html
Array
(
[0] => 1
[1] => 0
[2] => 1
[3] => 3
)
<img src="http://id.qq.com/level/img/crown.png" /><img src="http://id.qq.com/level/img/moon.png" /><img src="http://id.qq.com/level/img/star.png" /><img src="http://id.qq.com/level/img/star.png" /><img src="http://id.qq.com/level/img/star.png" />