织梦后台表单数据提醒
只是个简单查询:
1 在dede/index.php 中写入一行代码:require(DEDEADMIN.'/../plus/form_alert.php');
2 然后在 dede/templets/index2.htm 的 "<div class="sysmsg"><h3>滚动消息:</h3>" 部位改变代码:
<h3><?php if(isset($formAddMsg)){echo $formAddMsg . '有消息';} ?></h3>
<script type="text/javascript">
$(function(){
function getFormMsg() {
$.ajax({
type: 'get',
url: '/plus/form_alert_ajax.php',
data: 'getform=1',
dataType: 'json',
success: function(re) {
var res = re;
console.log(res);
if(res != 'false'){
$('.sysmsg>h3').text(res+'有消息');
} else {
$('.sysmsg>h3').text('无消息');
}
}
});
}
var timer = setInterval(getFormMsg,120000);
});
</script>
3 增加文件 ./plus/form_alert_ajax.php 代码:
1 <?php 2 require_once ("/../include/common.inc.php"); 3 4 if($dsql->IsTable('qx_diyform1')){ 5 //如果存在qx_diyform1表 6 //------------------- 7 $sql = "SELECT count(ifcheck) FROM qx_diyform1 WHERE ifcheck = 0"; 8 $dsql->Execute('me',$sql); 9 if($dsql->GetArray('me')['count(ifcheck)']>0){ 10 $formAddMsg = ' qx_diyform1 '; 11 } 12 } 13 if($dsql->IsTable('qx_diyform2')){ 14 //如果存在qx_diyform2表 15 //------------------- 16 $sql = "SELECT count(ifcheck) FROM qx_diyform2 WHERE ifcheck = 0"; 17 $dsql->Execute('me',$sql); 18 if($dsql->GetArray('me')['count(ifcheck)']>0){ 19 $formAddMsg .= ' qx_diyform2 '; 20 } 21 } 22 if($dsql->IsTable('qx_diyform3')){ 23 //如果存在qx_diyform3表 24 //------------------- 25 $sql = "SELECT count(ifcheck) FROM qx_diyform3 WHERE ifcheck = 0"; 26 $dsql->Execute('me',$sql); 27 if($dsql->GetArray('me')['count(ifcheck)']>0){ 28 $formAddMsg .= ' qx_diyform3 '; 29 } 30 } 31 $res = isset($formAddMsg) ? $formAddMsg : 'false'; 32 echo json_encode($res);
结果如下:
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了