日期:2014-05-17 浏览次数:20539 次
<?php
function substring($str, $start, $length)
{ //比较好用字符串截取函数
$len = $length;
if($length < 0){
$str = strrev($str);
$len = -$length;
}
$len= ($len < strlen($str)) ? $len : strlen($str);
for ($i= $start; $i < $len; $i ++)
{
if (ord(substr($str, $i, 1)) > 0xa0)
{
$tmpstr .= substr($str, $i, 2);
$i++;
} else {
$tmpstr .= substr($str, $i, 1);
}
}
if($length < 0) $tmpstr = strrev($tmpstr);
return $tmpstr;
}
?>
<?php
/**
* 当用户进入网站入口,程序会随机挑选三台服务器中的一台,然后返回重定项指令
*/
$domains = array(
'www1.flyxiang.com',
'www2.flyxiang.com',
'www3.flyxiang.com'
);
$index = substr(microtime(), 5, 3) % count($domains);
$domain = $domains[$index];
header("Localhost: http://$domain");
?>
<?php $url = "http://www.google.com"; echo "<script language='javascript' type='text/javascript'>"; echo "window.location.href='$url'"; echo "</script>"; ?>
<?php $url = "http://www.google.com/"; ?> <html> <head> <meta http-equiv="refresh" content="1;url=<?php echo $url;?>"> </head> <body> 页面只停留一秒…… </body> </html>
<?php $url = "http://www.google.com/"; ?>
<?php
重定向浏览器
header("Location: http://www.flyxiang.com/");
确保重定向后,后续代码不会被执行
exit;
?>