默认情况下,页面重定向到user/profilepicture/
或表值$user->profile
图片是否为null
。
if($this->session->userdata("user_id"))//If already logged in
{
$userID = $this->session->userdata("user_id");
$data['user'] = $this->m_user->getRows($userID);
//load the view
if($user->profile_pic == null)
{
redirect(base_url().'user/profilepicture/');
}else{
redirect(base_url().'blog/');
}
答案 0 :(得分:0)
尝试一下:
if($this->session->userdata("user_id"))//If already logged in
{
$userID = $this->session->userdata("user_id");
$data['user'] = $this->m_user->getRows($userID);
//load the view
if( $data['user']['profile_pic'] == null && $data['user']['profile_pic']!= null)
{
redirect(base_url().'user/profilepicture/');
}else{
redirect(base_url().'blog/');
}
答案 1 :(得分:-1)
if($this->session->userdata("user_id"))//If already logged in
{
$userID = $this->session->userdata("user_id");
$data['user'] = $this->m_user->getRows($userID);
//load the view
if($user->profile_pic==null)
{
$url = base_url().'user/profilepicture/';
}else{
$url = base_url().'blog/';
}
//echo $url; just check url copy and paset with new tab it is working or not ?
redirect($url);