我无法弄清楚我的代码有什么问题。它在这个函数中有问题,因为当我点击登录时的提交按钮时,页面是完全白色的,网址是http://localhost:8888/TESTING/PHP/HELLER-RECIPES/login/signup_validation
如果有人能帮我弄清楚我做错了什么,我会非常满意。
这是我的功能:
public function signup_validation(){
$this->load->library('form_validation');
$this->form_validation->set_rules('email','Email', 'required|trim|valid_email|is_unique[users.email]');
$this->form_validation->set_rules('password','Password', 'required|trim');
$this->form_validation->set_rules('cpassword','Confirm Password', 'required|trim|matches[password]');
$this->form_validation->set_message('is_unique', 'That email address already exist.');
if($this->form_validation->run()){
$key = md5(uniqid());
$this->load->library('email', array('mailtype'=>'html'));
$this->load->model('model_users');
$this->email->from('theller5567@gmail.com', 'Travis');
$this->email->to($this->input->post('email'));
$this->email->subject("confirm your account");
$message = "<h1>Thank you for signing up!</h1>";
$message.= "<p><a href='".base_url()."login/register_user/$key'>Click here</a> to confirm your account.</p>";
$this->email->message($message);
if($this->model_users->add_temp_user($key)){
//Send a email to the user
if($this->email->send()){
echo "The email has been sent";
} else echo "Could not send the email";
} else echo "Problem adding to database";
} else {
$this->load->view('includes/header');
$this->load->view('includes/navigation-header');
$this->load->view('signup');
$this->load->view('includes/bottom-nav');
$this->load->view('includes/footer');
}
}
我最好的猜测是这个问题存在于此部分:
if($this->model_users->add_temp_user($key)){
//Send a email to the user
if($this->email->send()){
echo "The email has been sent";
} else echo "Could not send the email";
} else echo "Problem adding to database";
} else {
我相信这个原因我没有遇到问题,直到我弄乱了代码的这一部分,如果我删除了这一部分我再也不会得到错误。