我是通过header('Location: ../index.php')跳转到index.php的,请问怎么获取跳转前的页面url,
用$_SERVER['HTTP_REFERER']貌似不可以。

解决方案 »

  1.   

    跳转时把url传过去,比如$pre_url=url_encode('http://127.0.0.1/xxx.php');
    header('Location: ../index.php?pre_url='.$pre_url);
      

  2.   

    谢谢,我说过了$_SERVER['HTTP_REFERER'] 不行,不信你可以试试
      

  3.   

    用<script>window.location='ok.php';</script> 来跳吧
      

  4.   

    $_SERVER['HTTP_REFERER'] 只有点击a链接有效
      

  5.   

    试出来了,有两种方法,
    1,就是2楼sink的方法;
    2,就是用session但是用session不知道会不会影响性能
      

  6.   

    就是,跳转时用ajax把跳转地址传过去也可以。
      

  7.   

    $pre_url=url_encode('http://127.0.0.1/xxx.php');
    header('Location: ../index.php?pre_url='.$pre_url);
      

  8.   

    http://topic.csdn.net/u/20090817/15/97965a38-9ed3-4edb-ba6a-cdb20e696cd6.html看看!老问题了
      

  9.   

    urlencode?我查了半天没有url_encode。
      

  10.   

    $_SERVER['HTTP_REFERER'] 这个是可以的!我都用过好几次了...
      

  11.   

    javascript模拟点击,http_referer应该可以的。