[英]Page redirecting to wrong url when table value null Codeigniter
默认情况下,页面重定向到user/profilepicture/
表值$user->profile
pic是否为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/');
}
尝试这个:
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/');
}
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);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.