/** * / * @param [type] $message [description] */ public function addMessage($message) { if ($this->session->has('system.messages')) { $messages = $this->session->has('system.messages'); } else { $messages = array(); } $messages[] = $message; $this->session->set('system.messages', $messages); }
/** * 检查用户注册时提交的邮箱是否否合规格 * @param [type] $email [description] * @param [type] $db_handle Medoo 实例化后的对象 * @return [type] [description] */ function check_user_email($email, $db_handle) { if (!preg_match('/^[a-z0-9_\\-]+(\\.[_a-z0-9\\-]+)*@([_a-z0-9\\-]+\\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)$/ ', $email)) { return [TRUE, '请填写正确的邮箱']; } else { if ($db_handle->has('users', ['email' => $email])) { return [TRUE, '该邮箱已经被注册']; } else { return [FALSE, '']; } } }