TPshop后台删除数据后页面不刷新如何解决?
时间:2025-1-8 08:33 作者:emer 分类: 无
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); } }登录后复制
修改后的代码在删除数据后会执行刷新页面操作,从而显示更新后的数据。
以上就是TPshop后台删除数据后页面不刷新如何解决?的详细内容,