相同的PHP脚本无法在其他服务器上运行 [英] Same PHP script does not work on different server

查看:78
本文介绍了相同的PHP脚本无法在其他服务器上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为进度栏编写PHP脚本.

我的代码:

I am writing PHP script for Progress bar.

My code:

<body>
<div id="progress" style="width:500px;border:1px solid #ccc;"></div>
<!-- Progress information -->
<div id="information" style="width"></div>


<?php
ob_start();
if(isset($_REQUEST['sub']))
{
// Total processes
    $total = 10;

    // Loop through process
    for($i=1; $i<=$total; $i++){
        // Calculate the percentation
        $percent = intval($i/$total * 100)."%";

        // Javascript for updating the progress bar and information
        echo '<script language="javascript">
        document.getElementById("progress").innerHTML="<div style=\"width:'.$percent.';background-color:#ddd;\">&nbsp;</div>";
        document.getElementById("information").innerHTML="'.$i.' row(s) processed.";
        </script>';

        // This is for the buffer achieve the minimum size in order to flush data
        echo str_repeat(' ',1024*64);

        // Send output to browser immediately
        ob_flush();
        flush();

        // Sleep one second so we can see the delay

        sleep(1);
    }

// Tell user that the process is completed
echo '<script language="javascript">document.getElementById("information").innerHTML="Process completed"</script>';
}
?>


<form>
<input type="submit" name="sub" value="Go" />
</form>
</body>




当我在服务器上对其进行测试时,它可以正常运行.但是在服务器上,它向我显示处理已完成".单击转到"按钮后..

我已经引用了本文,但是它对我不起作用.
请帮我.对我来说很痛苦.
我在两个服务器上都使用了相同的编码...

我的错是什么?有什么主意吗?
预先感谢.




when I test it on this server it runs properly. But on this server it show me "Process completed". after clicking Go button..

I have refer this Article But it does not work for me..
Please help me. it is pain for me.
I Used same coding on both server...

what is my mistake ? Any idea?
Thanks in advance.

推荐答案

_REQUEST [' sub' ])) { // 总进程
_REQUEST['sub'])) { // Total processes


总计 = 10 ; // 遍历整个过程 for(
total = 10; // Loop through process for(


i = 1;


这篇关于相同的PHP脚本无法在其他服务器上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆