PHP页面加载/刷新到确切位置 [英] PHP Page load/refresh to exact position

查看:221
本文介绍了PHP页面加载/刷新到确切位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做的是通过href链接将用户传递到php脚本,然后让他们传递回到单击链接之前的相同位置,例如页面没有刷新了.有谁知道这是否可能或怎么可能?谢谢.

What I'm trying to do is to pass a user to a php script via a href link, then have them passed back to exactly the same position that they were at before they clicked the link, like the page hasn't been refreshed. Does anyone know if or how this could be possible possible? Thank you.

推荐答案

使用HTML,您可以拥有以下

Using HTML you can have the following

<p id='open_here'><a href='script.php'> Send to script </a> </p>

然后您可以使用

<a href="mypage.html#open_here">Send Back to page</a>

因此,从本质上讲,您可以使用

So essentially, instead of using a regular link as in the previuos code snippet, you could redirect back to the page using

//php redirect
<?php header('Location: mypage.html#open_here'); ?>

//Javascript redirect
<script type='text/javascript'>
    window.location = "mypage.html#open_here";
</script>

这篇关于PHP页面加载/刷新到确切位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆