获取不到
alert(document.referrer)//获取来源地址

解决方案 »

  1.   

    test.html<img src="img.php">
    img.php<?php
    $im = imagecreate(1,1);
    imagecolorallocatealpha($im, 0, 0, 0, 255);
    imagepng($im);
    imagedestroy($im);
    file_put_contents('from.txt', $_SERVER['HTTP_REFERER'], true);
    ?>
    运行后,会生成from.txt,里面就是来源地址了。
      

  2.   

    可以使用$_SERVER['HTTP_REFERER'] 来取得来源地址.
      

  3.   

    这个应该简单吧
    $_SERVER['HTTP_REFERER'] 取得来源地址.,都是内置函数