php代码
代码如下 | 复制代码 |
function wppress_json(){//滚动的时候加载 $wp = M('Wppress'); $input = $_GET['page']; $start = $input*15; $list = $wp->limit("$start,15")->order("time desc")->select(); //$list['time']=1; foreach ($list as $key=>$val){//日期转变成我需要的格式 foreach ($val as $key2=>$val2){ if($key2=="time"){ $list[$key][$key2]=date("M d Y",$val2); } //dump($list['key']['key2']); } } //dump($list); if($list){ $this->ajaxReturn($list,'success',1); }else{ $this->error('Date end!'); } } function wppress(){//先加载的15条,也可以不需要这样先写。自己写过吧。 import('ORG.Util.Page'); $wp = M('Wppress'); $count= $wp->count(); $page = new Page($count,15); $showpage = $page->show(); $list = $wp->limit($page->firstRow.','.$page->listRows)->order("time desc")->select(); //dump($list); $this->assign('page',$showpage); $this->assign('aa',$list); $this->display('shanmao/wppress.html'); } |
html code:
代码如下 | 复制代码 |
loading... Loading... //loading 提示条 //end 提示条 |
js code:
代码如下 | 复制代码 |
|
这里只用一个php方法即可完成(wppress_json 方法):
代码如下 | 复制代码 |
|