体彩大乐透模拟机选随机号码_模拟

2021年9月20日 19点热度 0条评论 来源: 醉卧饮千觞

简易版本一:  

<?php
/**
 * 体彩大乐透模拟机选随机号码
 * @copyright LUCKY
 * @author Cfp
 * @file test.php
 * @version v.1.0
 * @date 2018/4/3 19:47
 *
 */

/**
 * Class LotteryClass
 * @author Cfp
 * @$_type int 彩票类型 1 大乐透 2 待定 3 待定
 * @$_num int 模拟数据组数
 * @date 2018/6/30 14:58
 */
class LotteryClass {
    public $_type;//1体彩大乐透
    public $_num;//模拟数据组数

    function __construct($type='',$num=''){ //初始化对象,将初始化值放在括号内
        $this->_num=$num;
        $this->_type=$type;
    }

    public function setType($value){
        $this->_type = $value;
    }

    public function setNum($value){
        $this->_num = $value;
    }

//体彩大乐透
    public function getLotteryNumberDLT(){
        $temp_str = '';
        $temp_arr = array_merge($this->getNoRand(1,35,5),$this->getNoRand(1,12,2));//生成大乐透模拟数据数组

        foreach($temp_arr as $key => $value){//拼接成数组
            if($value < 10 ){
                $temp_value = '0'.$value;//一个数则做前置0处理
            }else{
                $temp_value = $value;
            }
            if($key == 4){
                $temp_str .= $temp_value.' + ';
            }else{
                $temp_str .= $temp_value.' _ ';
            }
            $temp_str .= $temp_value.' _ ';
        }
        return trim($temp_str,' _ ');
    }

    public function getLotteryNumberDLTArray(){
        $temp_arr = array_merge($this->getNoRand(1,35,5),$this->getNoRand(1,12,2));//生成大乐透模拟数据数组
        return $temp_arr;
    }
    public function getLotteryNumberDLTArrayMore(){
        $temp_data = array();
        if($this->_num){
            for($i=1;$i<=$this->_num;$i++){
                $temp_data[$i]= $this->getLotteryNumberDLTArray();
            }
        }
        return $temp_data;
    }

    public function getLotteryNumberDLTMore(){
        $temp_data = array();
//$temp_data['0'] = '体彩大乐透,祝君中奖~';
        if($this->_num){
            for($i=1;$i<=$this->_num;$i++){
                $temp_data[$i]= $this->getLotteryNumberDLT();
            }
        }
        return $temp_data;
    }

    protected function getNoRand($begin=0,$end=20,$limit=5){
        $rand_array=range($begin,$end);
        shuffle($rand_array);//调用现成的数组随机排列函数
        $arr_tmp = array_slice($rand_array,0,$limit);
        sort($arr_tmp);
        return $arr_tmp;//截取前$limit个
    }

}

$Lottery_obj = new LotteryClass(1,5);
//$test_data = $Lottery_obj->getLotteryNumberDLTMore();
$test_data2 = $Lottery_obj->getLotteryNumberDLTArrayMore();

//var_dump($test_data2);

/*
array (size=6)
0 => string '体彩大乐透,祝君中奖~' (length=31)
1 => string '18 _ 21 _ 02 _ 20 _ 09 + 11 _ 12' (length=34)
2 => string '28 _ 07 _ 18 _ 09 _ 27 + 10 _ 07' (length=34)
3 => string '08 _ 06 _ 12 _ 19 _ 30 + 04 _ 03' (length=34)
4 => string '32 _ 01 _ 26 _ 18 _ 16 + 09 _ 11' (length=34)
5 => string '34 _ 08 _ 21 _ 15 _ 07 + 08 _ 04' (length=34)
*/

?>

 

完善页面版本二:  

<?php
/**
 * 体彩大乐透模拟机选随机号码
 * @copyright LUCKY
 * @author Cfp
 * @file test.php
 * @version v.1.5
 * @date  2018/4/3 19:47
 *
 */

/**
 * Class LotteryClass
 * @author Cfp
 * @$_type int 彩票类型 1 大乐透 2 待定 3 待定
 * @$_num int 模拟数据组数
 * @date  2018/4/14 13:58
 */
class LotteryClass {
    public $_type;//1体彩大乐透
    public $_num;//模拟数据组数

    function __construct($type='',$num=''){ //初始化对象,将初始化值放在括号内
        $this->_num=$num;
        $this->_type=$type;
    }

    public function setType($value){
        $this->_type = $value;
    }

    public function setNum($value){
        $this->_num = $value;
    }

    //体彩大乐透
    public function getLotteryNumberDLT(){
        $temp_str = '';
        $temp_arr = array_merge($this->getNoRand(1,35,5),$this->getNoRand(1,12,2));//生成大乐透模拟数据数组

        foreach($temp_arr as $key => $value){//拼接成数组
            if($value < 10 ){
                $temp_value = '0'.$value;//一个数则做前置0处理
            }else{
                $temp_value = $value;
            }
            if($key == 4){
                $temp_str .= $temp_value.'  +  ';
            }else{
                $temp_str .= $temp_value.' _ ';
            }
            $temp_str .= $temp_value.' _ ';
        }
        return trim($temp_str,' _ ');
    }

    public function getLotteryNumberDLTArray(){
        $temp_arr = array_merge($this->getNoRand(1,35,5),$this->getNoRand(1,12,2));//生成大乐透模拟数据数组
        return $temp_arr;
    }
    public function getLotteryNumberDLTArrayMore(){
        $temp_data = array();
        if($this->_num){
            for($i=1;$i<=$this->_num;$i++){
                $temp_data[$i]= $this->getLotteryNumberDLTArray();
            }
        }
        return $temp_data;
    }

    public function getLotteryNumberDLTMore(){
        $temp_data = array();
        //$temp_data['0'] = '体彩大乐透,祝君中奖~';
        if($this->_num){
            for($i=1;$i<=$this->_num;$i++){
                $temp_data[$i]= $this->getLotteryNumberDLT();
            }
        }
        return $temp_data;
    }

    protected function getNoRand($begin=0,$end=20,$limit=5){
        $rand_array=range($begin,$end);
        shuffle($rand_array);//调用现成的数组随机排列函数
        $arr_tmp = array_slice($rand_array,0,$limit);
        sort($arr_tmp);
        return $arr_tmp;//截取前$limit个
    }

}

$Lottery_obj = new LotteryClass(1,5);
//$test_data = $Lottery_obj->getLotteryNumberDLTMore();
$test_data2 = $Lottery_obj->getLotteryNumberDLTArrayMore();

//var_dump($test_data2);

/*
array (size=6)
  0 => string '体彩大乐透,祝君中奖~' (length=31)
  1 => string '18 _ 21 _ 02 _ 20 _ 09  +  11 _ 12' (length=34)
  2 => string '28 _ 07 _ 18 _ 09 _ 27  +  10 _ 07' (length=34)
  3 => string '08 _ 06 _ 12 _ 19 _ 30  +  04 _ 03' (length=34)
  4 => string '32 _ 01 _ 26 _ 18 _ 16  +  09 _ 11' (length=34)
  5 => string '34 _ 08 _ 21 _ 15 _ 07  +  08 _ 04' (length=34)
*/

?>

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>体彩大乐透,祝君中奖~</title>
</head>
<style>
       .btn-primary {
           width: 100%;
        margin-top: 5px;
        margin-bottom: 5px;
        color: #fff;
        background-color: #337ab7;
        text-align: center;
        border-color: #2e6da4;
        display: inline-block;
        padding: 6px 12px;
        font-size: 14px;
        font-weight: 400;
        line-height: 1.42857143;
        text-align: center;
        white-space: nowrap;
        vertical-align: middle;
        touch-action: manipulation;
        cursor: pointer;
        user-select: none;
        background-image: none;
        border: 1px solid transparent;
        border-radius: 4px;
        font-family: inherit;
        overflow: visible;

    }
</style>
<body>
   <div style="padding:0 20px">
       <table border="1" cellpadding="0" cellspacing="0" width="100%">
           <tbody>
           <tr>
               <th colspan="7" align="center"><h1 style="color:#3c8dbc;">体彩大乐透,祝君中奖~</h1></th>
           </tr>
           <?php foreach ($test_data2 as $key => $value){ ?>
               <tr align="center">
                   <?php foreach ($value as $k => $v){ ?>
                       <?php if ($k == 5 || $k == 6){?>
                           <td style="width: 15%;text-align: center">
                               <h3 style="color: red">
                                   <?php if ($v <10){
                                       echo '0'.$v;
                                   }else{
                                       echo $v;
                                   }?>
                               </h3>
                           </td>
                       <?php }else{?>
                           <td>
                               <h3 style="width: 15%;text-align: center">
                                   <?php if ($v <10){
                                       echo '0'.$v;
                                   }else{
                                       echo $v;
                                   }?>
                               </h3>
                           </td>
                       <?php }?>
                   <?php }?>
               </tr>
           <?php }?>
           </tbody>
       </table>
   </div>
<br />
<br />
    <div style="width: 100%;margin: 0 auto;">
        <div style="width: 40%;margin: 0 auto">
            <button type="button" class="btn btn-primary"  onclick="replaceDoc()">再选一次</button>
        </div>
    </div>
<!--<a href="http://www.16u.top/index.php" style="text-decoration:none ;font-size:50px;">再选一次</a>-->

<div style="padding:0 20px;">
    <div class="help_t_int">
        <h2>大乐透玩法</h2>
        <p>超级大乐透是指由购买者从01—35共35个号码中选取5个号码为前区号码,并从01—12共12个号码中选取2个号码为后区号码组合为一注彩票进行的基本投注。每注金额人民币2元。</p>
        <p>在本站中,大乐透支持的玩法有:大乐透单式投注,大乐透复式投注,大乐透方案粘贴</p>
        <p>
            <strong>
            </strong>
        </p>
        <p>
            <strong>大乐透单式投注:</strong>由购买者从01—35共35个号码中选取5个号码为前区号码,并从01—12共12个号码中选取2个号码为后区号码,组合为一注彩票进行的基本投注。</p>
        <p class="f_center"><img alt="大乐透玩法_大乐透规则_超级大乐透玩法规则" style="width: 98%" src="http://img5.cache.netease.com/help/2013/5/13/20130513115315a0576.png"></p>
    </div>
    <br>
    <div class="help_t_int">
        <h2>中奖规则</h2>
        <p class="f_center"><img alt="大乐透玩法_大乐透中奖规则【2014最新】_超级大乐透中奖规则_奖金" style="width: 98%" src="http://img4.cache.netease.com/sports/2014/5/5/20140505211309dffc6.png"><br>
        </p>
        <p>超级大乐透根据投注号码与开奖号码相符情况确定相应中奖资格。具体规定如下:</p>
        <p>一等奖:投注号码与当期开奖号码全部相同(顺序不限,下同),即中奖;</p>
        <p>二等奖:投注号码与当期开奖号码中的5个前区号码及任意1个后区号码相同,即中奖;</p>
        <p>三等奖:投注号码与当期开奖号码中的5个前区号码相同,或者任意4个前区号码及2个后区号码相同,即中奖;</p>
        <p>四等奖:投注号码与当期开奖号码中的任意4个前区号码及任意1个后区号码相同,或者任意3个前区号码及2个后区号码相同,即中奖;</p>
        <p>五等奖:投注号码与当期开奖号码中的任意4个前区号码相同,或者任意3个前区号码及1个后区号码相同,或者任意2个前区号码及2个后区号码相同,即中奖;</p>
        <p>六等奖:投注号码与当期开奖号码中的3个前区号码相同,或者任意1个前区号码及2个后区号码相同,或者任意2个前区号码及任意1个后区号码相同,或者2个后区号码相同,即中奖。</p>
        <p>当期每注投注号码只有一次中奖机会,不能兼中兼得,特别设立奖除外。</p>
    </div>

</div>

</body>
</html>
<script>
    function replaceDoc()
    {
        window.location.reload()
    }
</script>

 

    原文作者:醉卧饮千觞
    原文地址: https://blog.csdn.net/fjfuping/article/details/80867111
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。