<?php
/**
* 双色球开奖
*/
//创建1-33之间的红球数组
$red_ball = range(1,33);
//随机从红球中选出6个红球
$temp = array_rand($red_ball,6);
//打乱顺序
shuffle($temp);
//在单位红球上加前导0
foreach ($temp as $i) {
$red[]=$red_ball[$i]<10?('0'.$red_ball[$i]):$red_ball[$i];
}
echo '<h2 align="center" style="color: green">今天的开奖号码</h2>';
//随机生成篮球
$blue_ball = mt_rand(1,16);
//给篮球加前导0
$blue = $blue_ball<10?('0'.$blue_ball):$blue_ball;
echo '<div style="width: 100%;height: 40px;background: white;text-align:center;font-weight: bolder">';
foreach ($red as $value) {
echo "<span style='color:red'>{$value} </span>";
}
echo "<span style='color:blue'>{$blue}</span>";
echo '<input type="button" value="开奖" onclick="javascript: location.reload(true);"';
echo '</div>';
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号