在php中重定向到特定div
问题描述:
大家好,
我是php新手。任何人都可以帮助我如何在php页面重定向特定的div ..我正在使用header()函数,但它将进入默认的div页面,但我想去特定的div ..
谢谢
Hi all,
I am new to php. Can anybody help me to how to redirect perticular div in php page..i am using header() function but its going to default div of page but i want to go to perticular div..
thanks
答
我不确定你在这里要求什么。我会在预感上发布一个答案然后告诉我你是否想要它。
如果我理解你的话,你甚至不需要PHP ...您需要做的就是将以下代码放在您想要去的DIV的开头。
I'm not exactly sure what you are asking for here. I'll post an answer on a hunch and you tell me if it's what you want.
If I understand you correctly, you don't even need PHP for this... all you need to do is put the following code at the beginning of the DIV that you want to go to.
<a id="linkID"></a>
然后将以下链接放在您希望用户点击它的位置以重定向到该DIV
And then put the following link where you want the user to click on it to be redirected to that DIV
<a href="#linkID"></a>
在目的地页面中说page2.html,标识带有id的div,例如
In your destination page say page2.html, identify the div with id, e.g.
<div id="myplace">...</div>
接下来,在你的php中,添加:
Next, in you php, add this:
<?php
header('Location: http://www.yoursite.com/page2.html#myplace') ;
?>