public function addHead()
 {
     if (($head = I('post.head')) != '' && !empty($_FILES['head_image']['name'])) {
         $IS = new ImageService();
         $info = $IS->uploadHead($head, $_FILES['head_image']);
         if ($info !== true) {
             $this->error($info, U('Image/addHead'), 2);
         }
         redirect(U('Image/head'));
     }
     $this->display('addHead');
 }
 /**
  * 
  * 修改用户信息
  */
 public function modUser()
 {
     #取出用户信息
     if (is_numeric($id = I('id', '', 'intval'))) {
         $US = new UsersService();
         #当数据提交时,id是否一致,然后执行修改
         if (I('post.id', '', 'intval') === $id) {
             $US->doModUser(I('post.'));
         }
         #需要提取的字段
         $field = array('username', 'niconame', 'age', 'sex', 'head', 'address', 'sign');
         $userinfo = $US->getUserInfo($id, $field);
     } else {
         $this->redirect('Users/index');
     }
     #模板遍历用数组
     $sexlist = array('0' => '保密', '1' => '男', '2' => '女');
     $IS = new ImageService();
     $headlist = $IS->getHeads();
     #显示模板
     $this->assign('headlist', $headlist);
     $this->assign('sexlist', $sexlist);
     $this->assign('userinfo', $userinfo);
     $this->display('Users/modUser');
 }