现场网站上的Chrome setcookie不起作用

时间:2014-08-26 10:33:47

标签: php wordpress google-chrome cookies

我有一个WordPress应用程序,可以在特定的查询参数上设置cookie。代码负责此

define('CBP_IR_PARAMETER', 'clickid');
define('CBP_IR_COOKIE', 'clickref');

class IRCookie {

    public static function setIRCookie() {

        $clickid = isset($_GET[CBP_IR_PARAMETER]) ? $_GET[CBP_IR_PARAMETER] : null;

        if (isset($clickid) && null != $clickid ) {
            // set cookie for 1 hour
            setcookie(CBP_IR_COOKIE, $clickid, time() + 36000, COOKIEPATH, COOKIE_DOMAIN);
        }
    }

    public static function addQueryVars($vars) {
        $vars[] = CBP_IR_PARAMETER;
        return $vars;
    }
}

url - http://comms4.mobi/?clickid=2vox8OWRBTdsWTU3VF1t4wWnUkQydJx1JXdEV00#

这适用于FireFox以及该应用的Chrome localhost版本。

Localhost response headers
Connection:Keep-Alive
Content-Encoding:gzip
Content-Length:9321
Content-Type:text/html; charset=UTF-8
Date:Tue, 26 Aug 2014 10:26:55 GMT
Keep-Alive:timeout=5, max=100
Link:<http://c4b.localhost.com/?p=2336>; rel=shortlink
Server:Apache/2.2.22 (Ubuntu)
Set-Cookie:clickref=2vox8OWRBTdsWTU3VF1t4wWnUkQydJx1JXdEV00; expires=Tue, 26-Aug-2014 20:26:55 GMT; path=/I've checked response headers 
Vary:Accept-Encoding
X-Pingback:http://c4b.localhost.com/xmlrpc.php
X-Powered-By:PHP/5.3.10-1ubuntu3.11

实时网站响应标题

Accept-Ranges:bytes
Age:0
Connection:keep-alive
Content-Encoding:gzip
Content-Length:9399
Content-Type:text/html; charset=UTF-8
Date:Tue, 26 Aug 2014 10:25:11 GMT
Link:<http://comms4.mobi/>; rel=shortlink
Server:Apache
Vary:Accept-Encoding
Via:1.1 varnish
X-Pingback:http://comms4.mobi/xmlrpc.php
X-Varnish:1800127479

我确信在现场它会进入setcookie(),因为我已经尝试过死亡()。 任何线索?

0 个答案:

没有答案