全球主机交流论坛
标题:
判断次数 平均跳转的代码 有木有?》?????????...
[打印本页]
作者:
有容乃大
时间:
2013-4-26 18:38
标题:
判断次数 平均跳转的代码 有木有?》?????????...
go.html?go.php?go.asp
跳转目标站3个a.com b.com c.com
打开100次 平均分配到每个站30次的 跳转代码有木有?
作者:
八戒
时间:
2013-4-26 19:29
简单的用random随机跳转吧,概率一样的
作者:
有容乃大
时间:
2013-4-26 20:10
怎么写 求教!!
作者:
mike
时间:
2013-4-26 20:12
tongqiu
作者:
onepeople
时间:
2013-4-26 20:19
我不说。。
作者:
有容乃大
时间:
2013-4-26 21:48
真心求
作者:
icebin
时间:
2013-4-27 08:12
<?php
$url[0] = "http://www.hao123.com/";
$url[1] = "http://www.baidu.com/ ";
$url[2] = "http://www.google.cn/ ";
srand ((double)microtime()*1000000);
$randomnum = rand(0, count($url)-1);
header ("Location: $url[$randomnum]");
?>
srand ((double)microtime()*1000000);//这句是取一个随机数种子,产生随机数用的
$randomnum = rand(0, count($url)-1);//这句是产生一个0和url数量-1之间的随机数,也就是上面的地址数组的下标
header ("Location: $url[$randomnum]");//这句是跳转指令
作者:
八戒
时间:
2013-4-27 09:49
本帖最后由 八戒 于 2013-4-27 09:50 编辑
<html>
<head>
<title></title>
<script type="text/javascript">
function Redirect() {
var i = Math.floor(Math.random() * 3 + 1);
var url = "http://443502.xyz";
switch (i) {
case 1:
break;
case 2:
url = "http://443502.xyz";
break;
case 3:
url = "http://443502.xyz";
break;
default:
}
window.location.href = url;
}
</script>
</head>
<body onload="Redirect()">
</body>
</html>
复制代码
js随机跳转
作者:
八戒
时间:
2013-4-27 09:52
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
function Redirect() {
var a = 0, b = 0, c = 0;
for (var i = 0; i < 100; i++) {
var r = Math.floor(Math.random() * 3 + 1);
var url = "http://443502.xyz";
switch (r) {
case 1:
a++;
break;
case 2:
url = "http://443502.xyz";
b++;
break;
case 3:
url = "http://443502.xyz";
c++;
break;
default:
}
//window.location.href = url;
}
document.write("跳a " + a + "次 " + "跳b " + b + "次 " + "跳c " + c + "次 ");
}
</script>
</head>
<body onload="Redirect()">
</body>
</html>
复制代码
测试结果
欢迎光临 全球主机交流论坛 (https://443502.xyz/)
Powered by Discuz! X3.4