0
내 모델에서 만든 컨트롤러에서 변수를 사용하려고합니다. 사전에CodeIgniter에서 내 컨트롤러에서 사용할 변수를 모델에서 가져 오는 방법은 무엇입니까?
public function retrieve()
// REQUEST PASSWORD RESET
// LOADED WHEN THE FORM IS SUBMITTED OFF THE PASSWORD PAGE AND SENDS THE EMAIL WITH TOKEN AND INSTRUCTIONS
{
$this->load->library('form_validation');
$this->load->library('session');
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
$this->load->model('user_model', 'um');
$this->load->library('encrypt');
$this->load->helper('url');
$submit = $this->input->post('submit');
$salt = $this->_salt();
if($submit)
// IF THE SUBMIT BUTTON IS SET
{
// START PROCESS TO CREATE $USER VARIABLE THAT HOLDS WHAT THE USER ENTERED IN THE FORM AND THAT CAN GET CHECKED AGAINST THE DB IN THE MODEL
$user = $this->um->validate_retrieve(array('email' => $this->input->post('email')));
// IF THE USER IS CREATED AND CHECKS OUT AND ALL OF THE ERRORS ARE CLEARED ON THE FORM
if($user && $this->form_validation->run() == TRUE) {
$domain = "clci.dev/index.php";
// CREATE A TOKEN LINK TO SEND TO THE USERS EMAIL THAT EXIST IN THE DB AND WAS ENTERED
$token = $this->um->token;
$link = "http://www.".$domain."/auth/reset/?token=$token";
$this->load->library('email');
$this->email->from('[email protected]', 'CysticLife');
$this->email->to($this->input->post('email'));
$this->email->subject('Reset Password');
$this->email->message("Please go to the following web address to reset your password:\n\n$link\n\n-Your friends at CysticLife\n\nPlease remember to add the cysticlife.org domain to your address book to ensure that you receive your CysticLife e-Notifications as requested.");
$this->email->send();
redirect('auth/success');
exit;
}
$this->form_validation->run() == FALSE;
$data['main_content'] = 'auth/password';
$this->load->view('includes/templates/main_page_template', $data);
$data['email_error'] = 'This email is invalid';
}
}
감사
$ whatever_id로 참조하는 내용을 이해하고 있는지 잘 모르겠습니다. 감사합니다 – LightningWrist
당신의 함수가 arguement를 필요로 함을 의미합니다 : validate_retrieve ($ data) 그 쿼리의 where 절에 영향을 미칩니다. 나는 whatever_id를 넣는다. 왜냐하면 내가 어떻게 호출하는지 예제를 포함하고 있지 않기 때문에이 함수에 실제로 전달한 것을 모른다. –
validate_retrieve의 필수 인수를 잘 포착하십시오. – sberry