本文整理汇总了PHP中UserAction::modify方法的典型用法代码示例。如果您正苦于以下问题:PHP UserAction::modify方法的具体用法?PHP UserAction::modify怎么用?PHP UserAction::modify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserAction
的用法示例。
在下文中一共展示了UserAction::modify方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testEdit
function testEdit($arr)
{
$userId = $_SESSION['user']->userId;
$username = $_SESSION['user']->username;
$nickname = $_SESSION['user']->nickname;
$department = $_SESSION['user']->department;
$location = $_SESSION['user']->location;
$description = $_SESSION['user']->description;
if ($arr["location"] != null and $arr["location"] != '') {
$location = $arr["location"];
}
if (isset($_FILES['savator'])) {
$fname = $_FILES['savator']["name"];
$cache_path = "icon/";
$uniqStr = uniqid(strtotime("now") . "_" . mt_rand(100000, 999999) . "_");
$suffix = strtolower(stristr($fname, "."));
$fname_new = $cache_path . $uniqStr . $suffix;
if ($suffix != '' and $suffix != null) {
if ($suffix != ".png" and $suffix != ".jpg" and $suffix != ".jpeg" and $suffix != ".gif") {
$result = new Response(false, "错误的图片格式");
return $result;
}
$ok = move_uploaded_file($_FILES['savator']['tmp_name'], $fname_new);
if ($ok === FALSE) {
$result = new Response(false, "上传失败!");
return $result;
} else {
$icon = $fname_new;
$user = UserAction::modify($userId, $username, $nickname, $department, $location, $description, $icon);
if ($user === UserAction::$MODIFY_FAIL) {
$result = new Response(false, "更新数据失败!");
return $result;
} elseif ($user === UserAction::$MODIFY_NO_USER) {
$result = new Response(false, "没有此用户!");
return $result;
} elseif ($user === UserAction::$MODIFY_NO_CHANGE) {
$result = new Response(false, "没有任何改变!");
return $result;
} elseif (isset($user)) {
$_SESSION['user'] = $user;
$result = new Response(true);
return $result;
}
}
}
} else {
$icon = $_SESSION['user']->icon;
$user = UserAction::modify($userId, $username, $nickname, $department, $location, $description, $icon);
if ($user === UserAction::$MODIFY_FAIL) {
$result = new Response(false, "更新数据失败!");
return $result;
} elseif ($user === UserAction::$MODIFY_NO_USER) {
$result = new Response(false, "没有此用户!");
return $result;
} elseif ($user === UserAction::$MODIFY_NO_CHANGE) {
$result = new Response(false, "没有任何改变!");
return $result;
} elseif (isset($user)) {
$_SESSION['user'] = $user;
$result = new Response(true);
return $result;
}
}
return new Response(false, "服务器故障");
}