
第一种:
header(location:你的上一页的路径); // 注意这个函数前不能有输出
第二种:
header(location:.getenv("HTTP_REFERER")); // 返回其调用页面
第三种:
echo"<script>alert('提交成功!');history.go(-1);</script>"; //返回上一页,弹窗确认
第四种:在第三种上改变:
echo"<script>history.go(-1);</script>"; //返回上一页,无需弹窗确认
其他1:
return json_encode(array('code'=>1,status=>"删除成功")); 返回个这种格式的
其他2:
javasecipt::confirmurl("网址",'应该是提示语')
其他3:
showmessage(L('delete').L('success'), HTTP_REFERER);
【示例】
/**
* 批量删除附件 自定义
*/
public function public_delete_all_zxb() {
$del_arr = array();
$del_arr = $_POST['aid'];
$attachment_index = pc_base::load_model('attachment_index_model');
if(is_array($del_arr)){
foreach($del_arr as $v){
$aid = intval($v);
$this->attachment->delete(array('aid'=>$aid));
$attachment_index->delete(array('aid'=>$aid));
}
//showmessage(L('delete').L('success'), HTTP_REFERER);
//return json_encode(array('code'=>1,status=>"删除成功"));
/*echo"<script>alert('提交成功!');history.go(-1);</script>";*/
echo"<script>history.go(-1);</script>"; //返回上一页
}
}
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/courses/262982.html