0
我正在爲我的註冊過程創建激活電子郵件。我需要將包含激活碼和電子郵件地址的變量從我的模型傳遞迴我的控制器,我將發送電子郵件。Codeigniter從模型到控制器返回變量
我的註冊表格當前將所有註冊數據寫入數據庫並創建並激活代碼。
如何將變量'activation_code'和'email'從我的模型傳遞迴我的控制器以用於我的電子郵件。
型號:
...
$new_member_insert_data = array(
'first_name' => $first_name,
'last_name' => $last_name,
'email_address' => $email,
'password' => hashPassword($salt, $password, $hash),
'activation_code' => activationCode($email, $hash.$salt),
'hash' => $hash
);
$insert = $this->db->insert('members', $new_member_insert_data);
return $insert;
}
控制器
$this->load->model('members_model');
if($this->members_model->create_member())//return variables here somehow
{
//get activation code + email variables
//send activation email
$this->session->set_flashdata('success', 'success');
redirect('home', 'location');
}
else
{
$viewdata['main_content'] = $category;
$this->load->view('includes/template', $viewdata);
}
我遵循你的建議,並運行第二個功能,通過電子郵件地址查找用戶並獲取激活碼。謝謝 – hairynuggets