无需激活直接同步登入discuz,php代码(直接可用)

 1 <?php
 2 /**
 3  * 抽奖
 4  * @param int $total
 5  */
 6 function getReward($total=1000)
 7 {
 8     $win1 = floor((0.12*$total)/100);
 9     $win2 = floor((3*$total)/100);
10     $win3 = floor((12*$total)/100);
11     $other = $total-$win1-$win2-$win3;
12     $return = array();
13     for ($i=0;$i<$win1;$i++)
14     {
15         $return[] = 1;
16     }
17     for ($j=0;$j<$win2;$j++)
18     {
19         $return[] = 2;
20     }
21     for ($m=0;$m<$win3;$m++)
22     {
23         $return[] = 3;
24     }
25     for ($n=0;$n<$other;$n++)
26     {
27         $return[] = '谢谢惠顾';
28     }
29     shuffle($return);
30     return $return[array_rand($return)];
31 }
32 
33 $data = getReward();
34 echo $data;
35 ?> 

 

 

posted @ 2015-01-19 11:42  颠 沛 流 离  阅读(231)  评论(0编辑  收藏  举报
954085890