如果$displayurl
等于bit.ly,goo.gl或owl.ly,我正在尝试重定向用户。它不起作用。下面的IF声明有什么问题吗?
$site1 = 'http://' . $cleanurl;
$displayurl = parse_url($site1, PHP_URL_HOST);
if ($displayurl == array(bit.ly, goo.gl, owl.ly))
{
session_write_close();
header("Location:http://www.domain.com/directory/file.php");
exit;
}
答案 0 :(得分:5)
你必须使用这段代码:
$domain = array("bit.ly", "goo.gl", "owl.ly");
if (in_array($displayurl, $domain)) {
session_write_close();
header("Location:http://www.domain.com/directory/file.php");
exit;
}