尝试使用Twitter登录。获取screen_name并设置为session和flashdata。当我再次尝试访问视图中的会话数据时,我什么都没得到 查看
<div class="logged-in-user offset9" id="user-navbar" >
<img class="img-circle" style="height:46px; width:46px;" src=""/>
<a href="./getting-started.html"><?php $this->session->flashdata('twitter_screen_name');?></a>
</div>
</div>
控制器
我在日志消息中获取了屏幕名称。
$access_token = $this->connection->getAccessToken($this->input->get('oauth_verifier'));
if ($this->connection->http_code == 200)
{
$this->session->set_userdata('access_token', $access_token['oauth_token']);
$this->session->set_userdata('access_token_secret', $access_token['oauth_token_secret']);
$this->session->set_userdata('twitter_user_id', $access_token['user_id']);
$this->session->set_userdata('twitter_screen_name', $access_token['screen_name']);
$this->session->set_flashdata('twitter_screen_name', $access_token['screen_name']);
$this->session->unset_userdata('request_token');
$this->session->unset_userdata('request_token_secret');
log_message('info','>>>>>>>>>>>Enter Twitter Login'.$this->session->userdata('twitter_screen_name'));
redirect(base_url('/'));
}
答案 0 :(得分:1)
而不是
<?php $this->session->flashdata('twitter_screen_name');?>
写
<?php echo $this->session->flashdata('twitter_screen_name');?>