php得到来源页面的url
比如,a.php的页面含有b.php的链接,用户从a.php页面进了b.php页面,现要得到b.php页面的来源页面a.php,
怎么得到呀,
thanks..

解决方案 »

  1.   

    a.php的页面含有b.php的链接 在这个b.php的链接中加个标志位flag=a
      

  2.   

    多谢楼上的,我想用php函数得到来源页面的url
      

  3.   

    echo getenv("HTTP_REFERER");//和$_SERVER("HTTP_REFERER");一样的作用 
    //pares_URL()解析url
      

  4.   

    echo $_SERVER['HTTP_REFERER'];方法二:
    你看下载资源时,csdn 登陆时,会将来源页面做为参数传递。
      

  5.   

    自己的网站用参数传递即可
    别人的网站点到你的网站用HTTP_REFERER两者都容易伪造
      

  6.   

    请参照 SERVER 服务器变量
      

  7.   

    用JavaScript来获取吧....
    如果是用php函数来获取的话,a连接会获取不到...<table width=100% cellpadding=0 cellspacing=0 border=0 ><script>thisURL = document.URL;thisHREF = document.location.href;thisSLoc = self.location.href;thisDLoc = document.location;strwrite = "<tr><td valign=top>thisURL: </td><td>[" + thisURL + "]</td></tr>"strwrite += "<tr><td valign=top>thisHREF: </td><td>[" + thisHREF + "]</td></tr>"strwrite += "<tr><td valign=top>thisSLoc: </td><td>[" + thisSLoc + "]</td></tr>"strwrite += "<tr><td valign=top>thisDLoc: </td><td>[" + thisDLoc + "]</td></tr>"document.write( strwrite );</script>thisDLoc = document.location; <BR>thisURL = document.URL; <BR>thisHREF = document.location.href; <BR>thisSLoc = self.location.href;<BR><script>thisTLoc = top.location.href;thisPLoc = parent.document.location;thisTHost = top.location.hostname;thisHost = location.hostname;strwrite = "<tr><td valign=top>thisTLoc: </td><td>[" + thisTLoc + "]</td></tr>"strwrite += "<tr><td valign=top>thisPLoc: </td><td>[" + thisPLoc + "]</td></tr>"strwrite += "<tr><td valign=top>thisTHost: </td><td>[" + thisTHost + "]</td></tr>"strwrite += "<tr><td valign=top>thisHost: </td><td>[" + thisHost + "]</td></tr>"document.write( strwrite );</script>thisTLoc = top.location.href; <BR>thisPLoc = parent.document.location; <BR>thisTHost = top.location.hostname; <BR>thisHost = location.hostname;<BR><script>tmpHPage = thisHREF.split( "/" );thisHPage = tmpHPage[ tmpHPage.length-1 ];tmpUPage = thisURL.split( "/" );thisUPage = tmpUPage[ tmpUPage.length-1 ];
    strwrite = "<tr><td valign=top>thisHPage: </td><td>[" + thisHPage + "]</td></tr>"strwrite += "<tr><td valign=top>thisUPage: </td><td>[" + thisUPage + "]</td></tr>"document.write( strwrite );</script><tr><td>