php 返回查询页面

来源:百度知道 编辑:UC知道 时间:2024/05/26 14:41:59
就是我先通过一个查询页面,查询到一些资料,然后我从查询的页面中删除了一些资料,因为删除是调用另外一个页面的,所以在删除之后如何再返回刚才查询的资料页面,而且资料是最新的。如何用php实现啊?!
<script type="text/javascript">
window.location = 'xxxx.php'; //xxxx.php是你显示资料的页面
</script>
不行啊!

<a href="#" onClick="window.history.back();">返回</a>
这个也不行啊!

用header("location:刚才的那个页面");
给你一个思路
page1.php
<a href=# onclick="do_delete.php?id=?">XXX</a>
do_delete.php
处理成功后->
1.php方式的
header("location:page1.php");
2.js方式的
<a href=# onclick="window.location='page1.php'">XX</a>

用 window.history.back() 或window.history.go() 之类都是不行的,它会使页面返回上一个访问的页面,这样得到的数据可能不是最新的(缓存)。最好是在你处理删除的php程序最后加上:

<script type="text/javascript">
window.location = 'xxxx.php'; //xxxx.php是你显示资料的页面
</script>

或者用PHP使页面重定向到显示页:
header('Location: xxxx.php');

<a href="#" onClick="history.go(-1);">返回</a>