Exemplo n.º 1
0
 /**
  * 更新用户信息
  * @return [type] [description]
  */
 public function updateuserinfo()
 {
     // 1就要保存空图片
     $imageFlag = $_POST['imageFlag'];
     $userkey = Session::get('userkey');
     $headimg = "nochange";
     $introduction = $_POST['introduction'];
     if (isset($_FILES['imagepic'])) {
         $imagepic = $_FILES['imagepic'];
     } else {
         $imagepic = "";
     }
     $sex = $_POST['sex'];
     $telphone = $_POST['telphone'];
     if ("" != $imagepic) {
         $size = $imagepic['size'];
         // 小于1m
         if ($size > 1048576) {
             // 返回
             return "toobig";
         }
         // 将头像转存
         $headimg = saveImage::zhuancun($imagepic);
     } else {
         // 为1的话说明只用默认图
         $headimg = "";
     }
     // 存入数据库
     $res = Users::addUserInfo($userkey, $introduction, $headimg, $sex, $telphone);
     if ($res == "1") {
         return "success";
     } else {
         return "faild";
     }
 }