聯(lián)系官方銷售客服
1835022288
028-61286886
if(IS_POST){
$post = \Phpcmf\Service::L('input')->post('data');
if(IS_AJAX){
$post['stime'] = \Phpcmf\Service::L('input')->post('stime');
$post['etime'] = \Phpcmf\Service::L('input')->post('etime');
}else{
$post['stime'] = strtotime($post['stime']);
$post['etime'] = strtotime($post['etime']) + 86399;
}
}
查詢按鈕是用’IS_POST‘來判斷,查詢是沒有問題的。導(dǎo)出用的是’ajax‘提交查詢,代碼如上,’IS_AJAX‘這里進(jìn)不來,這是為什么呢?
if(IS_POST){
$post = \Phpcmf\Service::L('input')->post('data');
if(IS_AJAX){
$post['stime'] = \Phpcmf\Service::L('input')->post('stime');
$post['etime'] = \Phpcmf\Service::L('input')->post('etime');
}else{
$post['stime'] = strtotime($post['stime']);
$post['etime'] = strtotime($post['etime']) + 86399;
}
}
查檢查是get還是post了
回復(fù)@對方正在輸入
<script type="text/javascript">
function dr_toword(fid,stime,etime){
$.ajax({
url: location.href,
type: "post",
dataType: "json",
data: {
womfile:fid,
stime:stime,
etime:etime,
t1:myChart_1.getDataURL(),
t2:myChart_2.getDataURL(),
t3:myChart_3.getDataURL(),
t4:myChart_4.getDataURL(),
t5:myChart_5.getDataURL(),
t6:myChart_6.getDataURL(),
t7:myChart_7.getDataURL(),
csrf_test_name: "5a26548e8aa8d6fbe533fa7bd0ea10c0"
},
success: function (data) {
if(data.status == 1){
window.open('/womdown-week-26.html', '_self');
}else{
dr_cmf_tips(1,"操作失敗,請稍后重試");
}
}
});
}
</script>
導(dǎo)出的方法是這樣的
你打印出一般情況下$_SERVER['HTTP_X_REQUESTED_WITH']默認(rèn)是XMLHttpRequest
所有你打印出來看下。
感覺你這個分開應(yīng)該在在加個傳遞數(shù)據(jù),比如action,導(dǎo)出是什么值然后判斷。
回復(fù)@億友 打印出IS_AJAX看下。點導(dǎo)出的后看下。