开发者

why does this cookie set in PHP keep returning null?

开发者 https://www.devze.com 2023-04-12 21:56 出处:网络
I am trying to set some cookie variables token variables received from twitter and am realizing that I keep getting a null variable for objects that are clearly not null...even for explicitly defined

I am trying to set some cookie variables token variables received from twitter and am realizing that I keep getting a null variable for objects that are clearly not null...even for explicitly defined strings. Here is the specific code section I am working with though

var_dump($token->oauth_token);
    var_dump($token->oauth_token_secret); // these are not null

        // Attempt to save to cookies
    setcookie('oauth_token', $token->oauth_token);
    setcookie('oauth_token_secret', $token->oauth_token_secret);
    var_dump($_COOKIE['oauth_token']); //these cookie variables are null...holds true开发者_Go百科 even for //simple strings...not just the complex twitter objects im working with...happens on chrome //and IE

All help is appreciated!


See http://www.php.net/setcookie (emphasis mine):

Once the cookies have been set, they can be accessed on the next page load with the $_COOKIE or $HTTP_COOKIE_VARS arrays.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号