本文整理汇总了PHP中Registration::userRegistration方法的典型用法代码示例。如果您正苦于以下问题:PHP Registration::userRegistration方法的具体用法?PHP Registration::userRegistration怎么用?PHP Registration::userRegistration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Registration
的用法示例。
在下文中一共展示了Registration::userRegistration方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registration
/**
* To register new user
* Subject for validations (e.g username length)
**/
public function registration()
{
$username = Param::get('username');
$password = Param::get('pword');
$password_match = Param::get('pword_match');
$fname = Param::get('fname');
$lname = Param::get('lname');
$email = Param::get('email');
$registration = new Registration();
$login_info = array('username' => $username, 'user_password' => $password, 'fname' => $fname, 'lname' => $lname, 'email' => $email);
//To check if all keys are null
if (!array_filter($login_info)) {
$status = "";
} else {
try {
foreach ($login_info as $key => $value) {
if (!is_complete($value)) {
throw new ValidationException("Please fill up all fields");
}
}
if (!is_password_match($password, $password_match)) {
throw new ValidationException("Password did not match");
}
$info = $registration->userRegistration($login_info);
$status = notice("Registration Complete");
} catch (ExistingUserException $e) {
$status = notice($e->getMessage(), "error");
} catch (ValidationException $e) {
$status = notice($e->getMessage(), "error");
}
}
$this->set(get_defined_vars());
}