error("登录超时,请重新登录",'/admin/login/index'); } $this->assign('className',CONTROLLER_NAME); $this->assign('funcName',ACTION_NAME); } public function uploadFile($rootPath) { $upload = new \Think\Upload();// 实例化上传类 $upload->maxSize = 3145728 ;// 设置附件上传大小 $upload->exts = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型 $upload->rootPath = $rootPath; // 设置附件上传根目录 $upload->saveName = array('uniqid',''); $upload->autoSub = true; //是否使用子目录保存上传文件 $upload->subType = 'date'; //子目录创建方式,默认为hash,可以设置为hash或者date $upload->dateFormat = 'Ym'; //子目录方式为date的时候指定日期格式 $info = $upload->upload(array($_FILES['file_data'])); // 上传文件 return $info; } //获取单词释义字符串 public function getWordsText($row){ $str = ''; $wordsKeys = array('words_n','words_pron','words_adj','words_num','words_v','words_adv','words_art','words_prep','words_conj','words_int','words_vt','words_vi','words_other',); foreach ($wordsKeys as $key){ if (!empty($row[$key])){ $arr = explode('_', $key); $str .= $arr[1].'.'.$row[$key]; } } return $str; } }