zoukankan      html  css  js  c++  java
  • php进度条

    php进度条

    效果图

    long_process.php

    <?php
    for($i=1;$i<=10;$i++){
        session_start();
        $_SESSION["progress"]=$i;
        session_write_close();
        sleep(1);
    }

    process.php

    <?php
    session_start();
    echo $_SESSION["progress"];

    index.php

    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>无标题文档</title>
    <script src="http://www.localhost.com/jquery.js"></script>
    <style>
    #container{
        position:relative;
        400px;
        height:30px;
        line-height:30px;    
        text-align:center;
        background:#999;
    }
    #progress{
        background:#399;    
        0;
    }
    #percent{
        position:absolute;    
        top:0;
        left:190px;
    }
    </style>
    </head>
    <body>
    <div id="container">
    <div id="progress">&nbsp;</div>
    <div id="percent"></div>
    </div>
    </body>

    <script>
    $.ajax({
        url:'long_process.php',
        success:function(data){}
    });

    function getProgress(){
        $.ajax({
            async:false,
            url:'progress.php',
            success: function(data){
                
                var w1=(parseInt(data)*400/10)+'px';
                var w2=(parseInt(data)/10*100)+'%';
                
                $("#progress").css({w2});
                $("#percent").html(w2);
                if(data==10){
                    clearInterval(timer);
                }
            }    
        });    
    }
    var timer=setInterval(function(){
        getProgress();    
    },1000);

    </script>
    </html>

  • 相关阅读:
    msf提权命令/meterpreter下的几个命令
    ms17010漏洞复现-2003
    复现IIS6.0远程命令执行漏洞
    代码审计之Finecms任意文件下载漏洞
    逻辑运算符
    RIP动态路由的配置
    跟着百度学习php之ThinkPHP的运行流程-2
    静态路由配置
    跟着百度学习php之ThinkPHP的运行流程-1
    外挂是怎么写的?
  • 原文地址:https://www.cnblogs.com/songzhenghe/p/4582313.html
Copyright © 2011-2022 走看看