本文整理汇总了PHP中UserDAO::update方法的典型用法代码示例。如果您正苦于以下问题:PHP UserDAO::update方法的具体用法?PHP UserDAO::update怎么用?PHP UserDAO::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserDAO
的用法示例。
在下文中一共展示了UserDAO::update方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
public function update($user)
{
$userDAO = new UserDAO();
//now build the array represting the php object...
$fields = array('user_type' => $user->getUserType(), 'username' => $user->getUsername(), 'user_password' => $user->getUserpassword(), 'user_full_name' => $user->getUserFullName(), 'user_status' => $user->getUserStatus(), 'email' => $user->getEmail(), 'user_last_valid_login' => $user->getUserLastValidLogin(), 'user_first_invalid_login' => $user->getUserFirstInvalidLogin(), 'user_faild_login_count' => $user->getUserFailedLoginCount(), 'user_create_date' => $user->getUserCreateDate(), 'modified_by' => $user->getModifiedBy(), 'modification_date' => $user->getModificationDate());
$userDAO->update($user->getUserId(), $fields);
}
示例2:
if ($_POST['email'] != $user->getEmail()) {
$user->setEmail($_POST['email']);
$modified = true;
}
$_POST['birthDate'] = $_POST['yBirthDate'] . '-' . $_POST['mBirthDate'] . '-' . $_POST['dBirthDate'];
if ($_POST['birthDate'] != $user->getBirthDate()) {
$user->setBirthDate($_POST['birthDate']);
$modified = true;
}
if ($_POST['address'] != $user->getAddress()) {
$user->setAddress($_POST['address']);
$modified = true;
}
if ($_POST['postalCode'] != $user->getPostalCode()) {
$user->setPostalCode($_POST['postalCode']);
$modified = true;
}
if ($_POST['city'] != $user->getCity()) {
$user->setCity($_POST['city']);
$modified = true;
}
if ($_POST['phoneNumber'] != $user->getPhoneNumber()) {
$user->setPhoneNumber($_POST['phoneNumber']);
$modified = true;
}
if ($modified) {
UserDAO::update($user);
}
}
}
$presenter->data['user'] =& $user;
示例3: authorize
echo json_encode($userDAO->selectById($id), JSON_NUMERIC_CHECK);
exit;
});
$app->get('/users/login/:mail/?', authorize(), function ($mail) use($userDAO) {
header("Content-Type: application/json");
echo json_encode($userDAO->selectByMail($mail), JSON_NUMERIC_CHECK);
exit;
});
$app->post('/users/?', authorize(), function () use($app, $userDAO) {
header("Content-Type: application/json");
$post = $app->request->post();
if (empty($post)) {
$post = (array) json_decode($app->request()->getBody());
}
echo json_encode($userDAO->insert($post), JSON_NUMERIC_CHECK);
exit;
});
$app->delete('/users/:id/?', authorize(), function () use($userDAO) {
header("Content-Type: application/json");
echo json_encode($userDAO->delete());
exit;
});
$app->put('/users/:id/?', function ($id) use($app, $userDAO) {
header("Content-Type: application/json");
$post = $app->request->post();
if (empty($post)) {
$post = (array) json_decode($app->request()->getBody());
}
echo json_encode($userDAO->update($id, $post), JSON_NUMERIC_CHECK);
exit;
});
示例4: execute
function execute()
{
$user = json_decode($_GET['user']);
$dao = new UserDAO();
$dao->update($user);
}