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

它仍然没有工作

+1

它'exit'不'太end' – BoltClock 2010-11-16 04:29:56

+0

@BoltClock。 – 2010-11-16 04:31:33

+0

'ereg'已弃用。使用'preg_match'。 – netcoder 2010-11-16 04:39:50

回答

3

试试这个:

<?php 

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

?> 
相关问题