我在 Codeigniter 框架中面临一个新问题。她是我的输出
大批 ( [id] => 2 [名字] => 马鲁夫 [姓氏] => Ifftekhar [蛞蝓] => [电子邮件] => support@russelhost.com [电子邮件订阅] => 1 [自我] => [电话] => 01767820010 [公司] => 罗素主机 [default_billing_address] => [default_shipping_address] => [ship_to_bill_address] => 真 [密码] => 0689d59aa30bdca7207db3d449255650 [活跃] => 1 [group_id] => 1 [已确认] => 0 [group_discount_formula] => - 0 [过期] => 1380390903 ) 遇到 PHP 错误 严重性:通知 消息:试图获取非对象的属性 文件名:控制器/secure.php 行号:46 阿比达苏丹娜
这是控制器
`$`email = `$`this->input->post('email'); `$`password = `$`this->input->post('password'); `$`remember = `$`this->input->post('remember'); `$`redirect = `$`this->input->post('redirect'); `$`login = `$`this->Customer_model->login(`$`email, `$`password, `$`remember); echo '/pre>-----'; print_r(`$`登录); echo 'abida Sultana'.`$`login->last_name; --------------------行号:46 出口();
和模型是
功能登录(`$`电子邮件,`$`密码,`$`remember = false){ `$`this->db->select('*'); `$`this->db->where('email', `$`email); `$`this->db->where('active', 1); `$`this->db->where('password', md5(`$`password)); `$`this->db->limit(1); `$`result = `$`this->db->get('customers'); `$`customer = `$`result->row_array(); 如果(`$`客户){ // 获取客户地址 `$`this->db->where(array('customer_id' => `$`customer['id'], 'id' => `$`customer['default_billing_address'])); `$`address = `$`this->db->get('customers_address_bank')->row_array(); if (`$`地址) { $fields = unserialize($address['field_data']); $customer['bill_address'] = $fields; $customer['bill_address']['id'] = $address['id']; // 保存地址 id 以供将来参考 } $this->db->where(array('customer_id' => $customer['id'], 'id' => $customer['default_shipping_address'])); $address = $this->db->get('customers_address_bank')->row_array(); 如果($地址){ $fields = unserialize($address['field_data']); $customer['ship_address'] = $fields; $customer['ship_address']['id'] = $address['id']; } 别的 { $customer['ship_to_bill_address'] = 'true'; } // 设置任意团体折扣 if ($customer['group_id'] != 0) { $group = $this->get_group($customer['group_id']); if ($group) { // 组可能不存在 if ($group->discount_type == "固定") { $customer['group_discount_formula'] = "-" 。$group->折扣; } 别的 { $percent = (100 - (float) $group->discount) / 100; $customer['group_discount_formula'] = '* (' . $percent . ')'; } } } 如果(!$记住){ $customer['expire'] = time() + $this->session_expire; } 别的 { $customer['expire'] = false; } // 将我们的客户放入购物车 $this->go_cart->save_customer($customer); 返回$客户; } 别的 { 返回假; } }