V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
echotpq
V2EX  ›  问与答

求教 php 链接 301 跳转问题

  •  
  •   echotpq · Oct 9, 2016 · 2167 views
    This topic created in 3490 days ago, the information mentioned may be changed or developed.

    header("Location: $url", true, 301); 如何在跳转前加入 cnzz 统计代码?

    9 replies    2016-10-09 17:48:10 +08:00
    lhbc
        1
    lhbc  
       Oct 9, 2016 via iPhone
    输出个 HTML 来跳转
    echotpq
        2
    echotpq  
    OP
       Oct 9, 2016 via Android
    @lhbc 再 header 前面加载第三方的统计代码可以吗?
    ryd994
        3
    ryd994  
       Oct 9, 2016 via Android
    先跳到一个你能控制的跳转页,然后再用 JS 跳到目标
    那些论坛做个跳转中间页不是没道理的
    crystom
        4
    crystom  
       Oct 9, 2016 via iPhone
    @echotpq 不行
    ahkxhyl
        5
    ahkxhyl  
       Oct 9, 2016
    header 貌似是优先解析 php 代码 所以再放 html 不行!我感觉应该是加个 html 放上统计 再做个 js 跳转!
    echotpq
        6
    echotpq  
    OP
       Oct 9, 2016 via Android
    @ahkxhyl 也就是说 除非加中间 html 页面跳转,否则无解了?
    ahkxhyl
        7
    ahkxhyl  
       Oct 9, 2016
    那你 在 php 里面输出 js 统计代码?
    b821025551b
        8
    b821025551b  
       Oct 9, 2016
    不如在新的页面加个?from=xxx 这样的参数。
    Jat001
        9
    Jat001  
       Oct 9, 2016
    你都在 headers 里发送 status code 301 了,浏览器还会解析 html 和 js ?还会发送 ajax 请求?
    https://tools.ietf.org/html/rfc2616#section-10.3.2
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1233 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 17:24 · PVG 01:24 · LAX 10:24 · JFK 13:24
    ♥ Do have faith in what you're doing.