本文整理匯總了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());
}