majianbo
V2EX  ›  问与答

PHP 跳转代码,跳转到随机二级域名的代码怎么改?

  •  
  •   majianbo · Apr 1, 2020 · 2863 views
    This topic created in 2429 days ago, the information mentioned may be changed or developed.
    <?php
    $url = [
    "http://baidu.com",
    "http://weibo.com",
    ];
    shuffle($url);
    header ('Location: '.$url[0]);
    ?>

    这个代码可以随机跳转上面这两个域名
    那么我想跳转到带时间戳的二级 例如:12468.baidu.com 或者 13579.weibo.com 该怎么改一下呢?
    7 replies  •  2020-04-01 09:28:49 +08:00
    AngryPanda
    AngryPanda
    Apr 1, 2020
    1
    楼主你闹着玩的么
    majianbo
    majianbo
    OP
    Apr 1, 2020
    2
    @AngryPanda 帮帮小白吧
    FaceBug
    FaceBug
    Apr 1, 2020
    3
    时间戳是 time(),剩下随机、拼接字符串你都会了啊。。
    majianbo
    majianbo
    OP
    Apr 1, 2020
    4
    @cepczkd 我这也是 copy 的 拼了半天没搞对 T.T
    FaceBug
    FaceBug
    Apr 1, 2020
    5
    @majianbo

    <?php
    $url = [
    "baidu.com",
    "weibo.com",
    ];
    shuffle($url);
    header ('Location: http://'.time().'.'.$url[0]);
    ?>
    majianbo
    majianbo
    OP
    Apr 1, 2020
    6
    @cepczkd 谢谢大佬!!!!!!!!!!
    yEhwG10ZJa83067x
    yEhwG10ZJa83067x
    Apr 1, 2020
    7
    小白也不是这么当的啊!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4891 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 01:57 · PVG 09:57 · LAX 17:57 · JFK 20:57
    ♥ Do have faith in what you're doing.