$actname) { $old_stageStrList .= '{size="'.$size_old[$i].'",act="'.$actname.'",name="'.$name_old[$i].'",code="'.$code_old[$i].'",silent="'.$silent_old[$i].'"},'; } } if( empty($subversion) ){ return -1; } $title = getTitle($subversion); //循环处理 $stageStrList = '{'; if ($old_stageStrList) { $stageStrList .= $old_stageStrList; } $luaFile = '';//生成的lua文件 $time = time(); $hotuploadPath = '../hotupdatefile/'.$device.'/'; foreach ($stagefile['name'] as $k => $fileName){ if (!$fileName) { continue; } $uploadName = $fileName; $filePath = $hotuploadPath.$uploadName; //echo $filePath."
"; $tmpName = $stagefile['tmp_name'][$k]; move_uploaded_file($tmpName, $filePath); $code = md5_file($filePath); rename($filePath, $hotuploadPath.$code); $size = round($stagefile['size'][$k]/1024); $act = trim($actList[$k]); $silent = 0; $stageStrList .= '{size="'.$size.'",act="'.$act.'",name="'.$uploadName.'",code="'.$code.'",silent="'.$silent.'"},'; } $stageStrList = rtrim($stageStrList, ','); $stageStrList .= '}'; $luaFile = 'local list = {ver = "'.$subversion.'", stage = '.$stageStrList.'} return list'; file_put_contents($hotuploadPath.'flist'.$title, $luaFile); echo "生成热更新文件成功, 点击查看生成配置文件: flist{$title}"; function getTitle($version){ $arr = explode('.', $version); array_pop($arr); $new = implode('.', $arr); return $new; }