登录
立即注册
首页
>
绿虎论坛
>
历史版块
>
编程
>
PHP
>
源码
求随机自动跳转代码
999999999
@Ta
2013-03-26
3400点击
求随机自转跳转代码,就是有几个网站用代码把它们方在同一个文件里,访问这个文件随机跳入其中个网址
隐藏样式
查看源码
回复列表(10|
隐藏机器人聊天
)
1
大药瓶子
@Ta
/ 2013-03-26 /
样
/
源
用随机函数
2
梦浪的小虾米
@Ta
/ 2013-03-26 /
样
/
源
这个,我也不会
3
999999999
@Ta
/ 2013-03-26 /
样
/
源
@
eoo
帮忙写下代码啥
4
月初
@Ta
/ 2013-03-26 /
样
/
源
把那些网址装进一个数组里,用shuffle()随机打乱它们的顺序,随便选择一个输出一个数组元素就好了
5
月初
@Ta
/ 2013-03-26 /
样
/
源
就像这样 $a=array(1,2,3,4); shuffle($a); echo $a[0];
6
Curtion
@Ta
/ 2013-03-26 /
样
/
源
1.建立一个文件url.txt写入要跳转的地址,每一个换行相当于一条
比如:
http://hu60.cn
(换行)
http://3gxk.net
最后一条不加换行!
2.建立文建url.php
<?php
$f=file(dirname(__file__)."/url.txt");
$an=count($f)-1;
$n=rand(0,$an);
?>
<meta http-equiv="refresh"content="0;
url=< ?php echo $f[$n]; ?>">
本人新手,未试这个能不能行,自测
7
999999999
@Ta
/ 2013-03-26 /
样
/
源
@
月初
不行
8
月初
@Ta
/ 2013-03-27 /
样
/
源
<?php
$d = array(
"
http://baidu.com
",
"
http://hu60.cn
",
"
http://know.com
",
"
http://mmm.com
"
);
shuffle($d);
?><html>
<head>
<meta http-equiv="refresh"content="5;url=<?=$d[0];?>">
</head>
</html>
9
月初
@Ta
/ 2013-03-27 /
样
/
源
@
999999999
看代码
10
999999999
@Ta
/ 2013-03-27 /
样
/
源
@
月初
可以了,谢谢阿
添加新回复
回复需要
登录
。
比如:
http://hu60.cn
(换行)http://3gxk.net
最后一条不加换行!
2.建立文建url.php
<?php
$f=file(dirname(__file__)."/url.txt");
$an=count($f)-1;
$n=rand(0,$an);
?>
<meta http-equiv="refresh"content="0;
url=< ?php echo $f[$n]; ?>">
本人新手,未试这个能不能行,自测
<?php
$d = array(
"http://baidu.com",
"http://hu60.cn",
"http://know.com",
"http://mmm.com"
);
shuffle($d);
?><html>
<head>
<meta http-equiv="refresh"content="5;url=<?=$d[0];?>">
</head>
</html>