服务器停止确认php更改


Server stops acknowledging php changes

我有一个php文件可以做到这一点:

$recresults = array('dupes' => $result, 'total' => $number2);
header('Content-type: application/json');
echo json_encode($recresults);

然后我将文件修改为:

$recresults = array('dupes' => $result, 'total' => $number2, 'thefield' => "WWW");
header('Content-type: application/json');
echo json_encode($recresults);

但当我检查googledevtools的network选项卡时,我发现它没有返回我添加的最后一个数组元素thefield。如果我试图在JavaScript中使用该元素的变量,我会得到未定义的data.thefield

因此,为了查看服务器是否确认了更改,我尝试将代码更改为:

$recresults = array('dupes' => $result, 'total' => $number2, 'thefield' => "WWW");
echo ("WTF SERVER?");

我还删除了ajax调用中的类型json。经过检查,我认为服务器没有确认我对php文件的更改是正确的。返回的代码仍然是来自第一个代码集的json。我尝试了一个改变php文件名的老把戏。不起作用。已尝试重新启动服务器。没有骰子。

我能做什么?服务器没有返回任何错误。

$.post(PROCESSORFILE, {"task": "csv_dedupe", "file_name": file_name, "column_dedupe":                                    elem}, function(data) {
                $("#message").replaceWith('<div id="message" class="nNote nSuccess hideit"><p><strong>CSV Deduped! </strong><span class="badge badge-important">' + data.thefield + '</span> duplicate<span class="label label-info"> ' + data.dupes+ '</span> found</p></div>')
            });

当我使用json_encode从php文件返回内容时,我将上面的JS $.post()更改为类型json

根据PROCESSORFILE变量的内容,尝试以下操作,将?替换为&

var cacheBuster = new Date().getTime() + Math.round(Math.random()*100000);
$.post(PROCESSORFILE + "?t=" + cacheBuster, {"task": "csv_dedupe", "file_name": file_name, "column_dedupe": elem}, function(data) {
    $("#message").replaceWith('<div id="message" class="nNote nSuccess hideit"><p><strong>CSV Deduped! </strong><span class="badge badge-important">' + data.thefield + '</span> duplicate<span class="label label-info"> ' + data.dupes+ '</span> found</p></div>')
});

这是缓存阻塞程序代码,以确保检索到php页面的新副本。