|
加入数据库后,生成session,然后回到首页,怎么调不出数据?
下面是加入库,生成session
PHP复制代码
$customer = array(
'customer_user' => $this->input->post('customer_name'),
'customer_password' => $this->input->post('customer_password'),
'customer_email' => $this->input->post('customer_email')
);
$this->load->model('customer_info_model');
$this->customer_info_model->insert($customer);
$this->session->set_userdata($customer);
redirect (site_url ());
复制代码
首页调session数据,怎么判断session里的customer_user已经注册(红色部分)?
PHP复制代码
<?php if ([color =Red ]! isset($_SESSION['customer_user'][/color ])) { ?>
您好,欢迎来到XXX!<a href=" <?php echo site_url ('login') ?>"><span class="font_orange">[登录]</span></a>,新用户?<a href=" <?php echo site_url ('login/reg') ?>">[免费注册]</a>
<?php } else { ?>
您好, <?php echo $this->session->userdata('customer_user'); ?>!欢迎您来到XXX!<a href=" <?php echo site_url ('login/logout') ?>">[退出]</a>
<?php } ?>
复制代码
|
|