本文整理汇总了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);
}