国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Heim php教程 PHP源碼 幸運(yùn)大轉(zhuǎn)盤-jQuery+PHP實(shí)現(xiàn)的抽獎程序-完善中

幸運(yùn)大轉(zhuǎn)盤-jQuery+PHP實(shí)現(xiàn)的抽獎程序-完善中

Jul 06, 2016 pm 01:28 PM

跳至 [1] [全屏預(yù)覽]
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>小雨在線網(wǎng)站自營銷研究</title>
    <link rel="stylesheet" type="text/css" href="css/style.css"/>
    <!--<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>-->
    <script src="//cdn.bootcss.com/jquery/3.0.0/jquery.min.js"></script>
    <script type="text/javascript" src="js/jQueryRotate.2.2.js"></script>
    <script type="text/javascript" src="js/jquery.easing.min.js"></script>


    <script type="text/javascript">


        $(function () {
            $("#startbtn").click(function () {
                lottery();
            });
        });
        function lottery() {
            $.ajax({
                type: 'POST',
                url: 'data.php',
                dataType: 'json',
                cache: false,
                error: function () {
                    alert('出錯了!');
                    return false;
                },
                success: function (json) {
                    $("#startbtn").unbind('click').css("cursor", "default");
                    var a = json.angle; //角度
                    var p = json.prize; //獎項(xiàng)
                    $("#startbtn").rotate({
                        duration: 3000, //轉(zhuǎn)動時間
                        angle: 0,
                        animateTo: 1800 + a, //轉(zhuǎn)動角度
                        easing: $.easing.easeOutSine,
                        callback: function () {
                            var con = confirm('恭喜你,中得' + p + '\n還要再來一次嗎?');
                            if (con) {
                                lottery();
                            } else {
                                return false;
                            }
                        }
                    });
                }
            });
        }


    </script>


</head>
<body class="keBody">
<h1 class="keTitle">小雨在線網(wǎng)站自營銷研究</h1>

<div class="kePublic">
    <!--效果html開始-->
    <div class="demo">
        <div id="disk"></div>
        <div id="start"><img  src="/static/imghw/default1.png"  data-src="images/start.png"  class="lazy" id="startbtn" alt="幸運(yùn)大轉(zhuǎn)盤-jQuery+PHP實(shí)現(xiàn)的抽獎程序-完善中" ></div>
    </div>
    <!--效果html結(jié)束-->
</div>


</body>
</html>

-----------data.php----------------------------------
<?php
/**
 * Created by 小雨在線
 * User: 飛天
 * Date: 2016/6/22 0022
 * Time: 下午 4:27
 */

$prize_arr = array(
    '0' => array('id' => 1, 'min' => 1, 'max' => 29, 'prize' => '一等獎', 'v' => 1),
    '1' => array('id' => 2, 'min' => 302, 'max' => 328, 'prize' => '二等獎', 'v' => 2),
    '2' => array('id' => 3, 'min' => 242, 'max' => 268, 'prize' => '三等獎', 'v' => 5),
    '3' => array('id' => 4, 'min' => 182, 'max' => 208, 'prize' => '四等獎', 'v' => 7),
    '4' => array('id' => 5, 'min' => 122, 'max' => 148, 'prize' => '五等獎', 'v' => 10),
    '5' => array('id' => 6, 'min' => 62, 'max' => 88, 'prize' => '六等獎', 'v' => 25),
    '6' => array('id' => 7, 'min' => array(32, 92, 152, 212, 272, 332), 'max' => array(58, 118, 178, 238, 298, 358), 'prize' => '七等獎', 'v' => 50)
);



function getRand($proArr)
{
    $result = '';

    //概率數(shù)組的總概率精度

    $proSum = array_sum($proArr);

    //概率數(shù)組循環(huán)
    foreach ($proArr as $key => $proCur) {
        $randNum = mt_rand(1, $proSum);
        if ($randNum <= $proCur) {
            $result = $key;
            break;
        } else {
            $proSum -= $proCur;
        }
    }
    unset ($proArr);

    return $result;
}


foreach ($prize_arr as $key => $val) {
    $arr[$val['id']] = $val['v'];
}

$rid = getRand($arr); //根據(jù)概率獲取獎項(xiàng)id

$res = $prize_arr[$rid - 1]; //中獎項(xiàng)
$min = $res['min'];
$max = $res['max'];
if ($res['id'] == 7) { //七等獎
    $i = mt_rand(0, 5);
    $result['angle'] = mt_rand($min[$i], $max[$i]);
} else {
    $result['angle'] = mt_rand($min, $max); //隨機(jī)生成一個角度
}
$result['prize'] = $res['prize'];

echo json_encode($result);



Erkl?rung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn

Hei?e KI -Werkzeuge

Undress AI Tool

Undress AI Tool

Ausziehbilder kostenlos

Undresser.AI Undress

Undresser.AI Undress

KI-gestützte App zum Erstellen realistischer Aktfotos

AI Clothes Remover

AI Clothes Remover

Online-KI-Tool zum Entfernen von Kleidung aus Fotos.

Clothoff.io

Clothoff.io

KI-Kleiderentferner

Video Face Swap

Video Face Swap

Tauschen Sie Gesichter in jedem Video mühelos mit unserem v?llig kostenlosen KI-Gesichtstausch-Tool aus!

Hei?e Werkzeuge

Notepad++7.3.1

Notepad++7.3.1

Einfach zu bedienender und kostenloser Code-Editor

SublimeText3 chinesische Version

SublimeText3 chinesische Version

Chinesische Version, sehr einfach zu bedienen

Senden Sie Studio 13.0.1

Senden Sie Studio 13.0.1

Leistungsstarke integrierte PHP-Entwicklungsumgebung

Dreamweaver CS6

Dreamweaver CS6

Visuelle Webentwicklungstools

SublimeText3 Mac-Version

SublimeText3 Mac-Version

Codebearbeitungssoftware auf Gottesniveau (SublimeText3)

Hei?e Themen

PHP-Tutorial
1502
276