- $data['status'] = 1;
- $data['info'] = 1;
- $data['url'] = 1;
- $m = M('webworkpage');
- $where ="satae = 0";
- $first = $m->where($where)->count();
- $num = $m->count();
- $data['size'] = $first;
- $data['sizes'] = $num;
- if ($num) {
- $this->ajaxReturn($data,'JSON');
- }else{
- $this->ajaxReturn($data,'JSON');
- }
- script language="JavaScript">
- //设置全局变量
- number = 0;
- count = 0;
- setInterval("check_news()",1000); //每隔一秒执行
- function check_news(){
- $.getJSON("{$a}",'',function(json){//获取php端传过来的json数据
- if(json.status==1){
- var num = json.size;
- var nums = json.sizes;
- if(num&&count==0){
- alert("有新消息"+num);
- number = nums;
- count++;
- }else if(number
- alert("有新消息"+number+"<"+nums);
- number = nums;
- }
- }else{
- }
- })
- }
- /script>
上一篇 网上搜集的百度排名最新算法
下一篇 一个网站被降权的常见原因