我正试图设置一些cookie变量令牌变量从twitter收到,我意识到我不断得到一个空变量的对象显然不是空的…即使对于显式定义的字符串也是如此。下面是我通过
处理的特定代码部分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 even for //simple strings...not just the complex twitter objects im working with...happens on chrome //and IE
感谢所有的帮助!
参见http://www.php.net/setcookie(强调我的):
一旦cookies被设置,它们就可以在下一页加载时使用$_COOKIE或$HTTP_COOKIE_VARS数组访问。