在php中重定向到特定div [英] redirecting to perticular div in php

查看:86
本文介绍了在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') ;
?>


这篇关于在php中重定向到特定div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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