Ejemplo n.º 1
0
 public function updateFace()
 {
     $errors = $this->errors;
     //实例化Model
     $adminModel = new AdminModel();
     $adminId = $_SESSION['admin']['adminId'];
     //上传文件处理
     if (isset($_FILES['file']['name']) && strlen($_FILES['file']['name']) > 0) {
         $arr = array('upload' => 'file', 'ext' => array('jpg', 'jpeg', 'png', 'gif'), 'size' => 10240, 'path' => './asset/upload');
         $file = upload($arr);
         //echo "<pre>";var_dump($file);echo "</pre>";exit;
         if ($file['result']) {
             $face = $file['message'];
         } else {
             E($file['message']);
         }
     }
     $row = $adminModel->updateFace($adminId, $face);
     if ($row) {
         $result['code'] = '0';
         $result['message'] = $errors['0'];
     } else {
         $result['code'] = '011';
         $result['message'] = $errors['011'];
     }
     echo json_encode($result);
     exit;
 }