当前位置: 首页>>代码示例>>PHP>>正文


PHP UserHelper::telFormatCheck方法代码示例

本文整理汇总了PHP中UserHelper::telFormatCheck方法的典型用法代码示例。如果您正苦于以下问题:PHP UserHelper::telFormatCheck方法的具体用法?PHP UserHelper::telFormatCheck怎么用?PHP UserHelper::telFormatCheck使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserHelper的用法示例。


在下文中一共展示了UserHelper::telFormatCheck方法的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);
}
开发者ID:Hank-wood,项目名称:meizizhi,代码行数:75,代码来源:user.php


注:本文中的UserHelper::telFormatCheck方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。