本文整理汇总了PHP中UserDao::check方法的典型用法代码示例。如果您正苦于以下问题:PHP UserDao::check方法的具体用法?PHP UserDao::check怎么用?PHP UserDao::check使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserDao
的用法示例。
在下文中一共展示了UserDao::check方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: json_encode
$userMark = null;
$userPass = '';
$userName = null;
if (isset($_REQUEST['openid'])) {
$userMark = $_REQUEST['openid'];
$userName = 'qq_';
} else {
$userMark = $_REQUEST['tel'];
$userPass = $_REQUEST['userPass'];
$userName = 'tel_';
}
/*
$userId=$_REQUEST['userId'];
$userPass=$_REQUEST['userPass'];
$userName=$_REQUEST['userName'];
*/
$userDao = new UserDao();
if ($userDao->check($userMark) > 0) {
echo json_encode(array('mesg' => 'already registered', 'result' => true));
exit;
}
$result = false;
while (!$result) {
$timestamp = strtotime(date("Y-m-d H:i:s"));
$userId = rand(10, 99) . substr($timestamp, 3);
$userName = $userName . $userId;
if ($userDao->register($userId, $userMark, $userName, $userPass) > 0) {
$result = true;
}
}
echo json_encode(array('userId' => $userId, 'userName' => $userName));
示例2: UserDao
<?php
require '../dao/UserDao.php';
$userMark = $_REQUEST['userMark'];
$userPass = $_REQUEST['userPass'];
$userDao = new UserDao();
if ($userDao->getUserPassByMark($userMark) == $userPass && $userDao->check($userMark)) {
echo json_encode(array('mesg' => 'success', 'result' => true, 'data' => json_decode($userDao->getUserInfoByMark($userMark))->resultArray[0]));
} else {
echo json_encode(array('mesg' => 'fail', 'result' => false, 'data' => null));
}