如果不是从$ _SERVER ['HTTP_REFERER']重定向?

时间:2010-11-16 04:21:00

标签: php

<?PHP
if (ereg("www\.test", $_SERVER['HTTP_REFERER']) != true)
{
    header("location http://www.example.com");
    end;
}
    echo "111";
        //dosomting?
?>

它仍无法正常工作

1 个答案:

答案 0 :(得分:3)

试试这个:

<?php

   if (!preg_match("www\.test", $_SERVER['HTTP_REFERER'])) {
      header("Location: http://www.example.com");
      exit();
   }
   //do stuff...

?>
相关问题