nginx服务器的问题

时间:2014-04-24 00:04:47

标签: javascript php nginx

我在php中有以下代码:

    <html>
    <head>
        <script stype="text/javascript">
            function ventanachat(){
                var xmlHttp;
                if (window.XMLHttpRequest)
                  {
                  xmlHttp=new XMLHttpRequest();
                  }
                else
                  {
                  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                  }
                  var fetch_unix_timestamp ="";
                    fetch_unix_timestamp = function()
                        {
                        return parseInt(new Date().getTime().toString().substring(0, 10))
                        }
                    var timestamp = fetch_unix_timestamp();
                xmlHttp.onreadystatechange=function(){
                        if(xmlHttp.readyState==4){
                            document.getElementById("ventanachat").innerHTML=xmlHttp.responseText;
                            setTimeout('ventanachat()',10);
                        }

                        }
                        xmlHttp.open("GET","db.php"+"?t="+timestamp,true);
                    xmlHttp.send(null);
            }
            window.onload = function startrefresh(){
                    setTimeout('ventanachat()',1000);
                }
        </script>
    </head>
    <body>
        <form action="insert.php" method="GET">
        <input type="text" name="mensaje" id="enviachat" >
            <input type="submit">
        </form>
        <div id="ventanachat" style="width:200px;height:200px;border:1px solid black;overflow:hidden;">
            <script type="text/javascript">
                ventanachat();
            </script>
        </div>
    </body>
</html>

这是一个非常基本的聊天页面,每1秒更新一次。 (insert.php和db.php文件只是协商而且很好)

它在Apache中运行得很完美,但Nginx对我不起作用。为什么?

(我说西班牙语,抱歉拼错了。请使用翻译)。感谢

0 个答案:

没有答案