ajax 长轮询后面的数字 url /controller/method?_xxxx

numbers behind the ajax long polling url /controller/method?_xxxx

我正在使用 codeigniter,我对我进行的长轮询的 get 查询很好奇

       function check_new_notif(){
            $.ajax({
                type:"GET",
                url:"/MAIN/AJAX/new_unotif",
                async:true,
                cache:false,
                datatype: "text",
                timeout:20000,

                success: function(dat){
                    show_new_notif(dat);
                    fetch_new_notif();
                    setTimeout(
                        check_new_notif,10000
                    );
                },
            error: function(XMLHttpRequest,textstatus,errorThrown){
                show_new_notif("error");
                setTimeout(
                    check_new_notif,10000
                );
            }
        });

这个号码有什么用? 当我在服务器上的长轮询请求时,firebug 中的链接是这样的

GET /MAIN/Ajax/notification?_=1466062273034

下一个调用它的 /MAIN/Ajax/notification?_=1466062273035 ,增加一个

有人知道这个 ?_=1466062273035 查询是什么意思吗?

谢谢

当您设置 cache: false 时,它会将时间戳附加到您的 URL

文档:http://api.jquery.com/jquery.ajax/

If set to false, it will force requested pages not to be cached by the browser. Note: Setting cache to false will only work correctly with HEAD and GET requests. It works by appending "_={timestamp}" to the GET parameters. The parameter is not needed for other types of requests, except in IE8 when a POST is made to a URL that has already been requested by a GET.