本文整理匯總了PHP中UserHelper::emailFormatCheck方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserHelper::emailFormatCheck方法的具體用法?PHP UserHelper::emailFormatCheck怎麽用?PHP UserHelper::emailFormatCheck使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserHelper
的用法示例。
在下文中一共展示了UserHelper::emailFormatCheck方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: signup
function signup($req)
{
$username = trim($req['username']);
$email = trim($req['email']);
$tel = trim($req['tel']);
$password = $req['password'];
$password2 = $req['password2'];
$response['status'] = 0;
if (empty($username)) {
$response['msg'] = "用戶名不能為空";
echo json_encode($response);
return;
}
if (strlen($username) < 2 || strlen($username) > 10) {
$response['msg'] = "用戶名長度需要在2到10位之間";
echo json_encode($response);
return;
}
if (UserService::verifyUsername($username)) {
$response['msg'] = "用戶名已存在";
echo json_encode($response);
return;
}
if (empty($email)) {
$response['msg'] = "郵箱格式不正確";
echo json_encode($response);
return;
}
if (!UserHelper::emailFormatCheck($email)) {
$response['msg'] = "郵箱格式不正確";
echo json_encode($response);
return;
}
if (UserService::verifyEmail($email)) {
$response['msg'] = "郵箱已被注冊";
echo json_encode($response);
return;
}
if (!empty($tel) && !UserHelper::telFormatCheck($tel)) {
$response['msg'] = "手機號碼格式不對";
echo json_encode($response);
return;
}
if (UserService::verifyTel($tel)) {
$response['msg'] = "手機號碼已被注冊";
echo json_encode($response);
return;
}
if (empty($password) || empty($password2)) {
$response['msg'] = "密碼不能為空";
echo json_encode($response);
return;
}
if ($password != $password2) {
$response['msg'] = "兩次輸入的密碼不一致";
echo json_encode($response);
return;
}
$user['userid'] = SequenceHelper::getSequence(SEQ_USER);
$user['username'] = $username;
$user['email'] = $email;
$user['tel'] = $tel;
$user['password'] = $password;
$user['cdate'] = time();
$user['udate'] = time();
$id = UserService::signup($user);
if ($id <= 0) {
$response['msg'] = "抱歉,係統錯誤注冊失敗";
echo json_encode($response);
return;
}
$response['status'] = 1;
setSessionCookie($user);
echo json_encode($response);
}