
tpshop重定向问题
问题:
在tpshop后台中,删除某模块数据后无法返回展示页并显示更新后的数据。
代码示例:
function lookdele(){
$id = i('get.id');
m('org_users')->where('user_id='.$id)->delete();
return $this->fetch('index');
}回答:
代码中缺少刷新页面操作,会导致删除数据后页面不会更新。以下为修改后的代码:
function lookdele(){
$id = I('get.id');
if($id){
M('org_users')->where('user_id='.$id)->delete();
$this->flash('删除成功'); // 自己写个刷新页面的方法
} else {
$r = M('org_users')->select();
return $this->fetch('index', $r);
}
}修改后的代码在删除数据后会执行刷新页面操作,从而显示更新后的数据。

















