//把金钱改成大写
public function toChineseNumber($money){
$money = round($money,2);
$cnynums = array("零","壹","贰","叁","肆","伍","陆","柒","捌","玖");
$cnyunits = array("圆","角","分");
$cnygrees = array("拾","佰","仟","万","拾","佰","仟","亿");
list($int,$dec) = explode(".",$money,2);
$dec = array_filter(array($dec[1],$dec[0]));
$ret = array_merge($dec,array(implode("",$this->cnyMapUnit(str_split($int),$cnygrees)),""));
$ret = implode("",array_reverse($this->cnyMapUnit($ret,$cnyunits)));
return str_replace(array_keys($cnynums),$cnynums,$ret);
}
public function cnyMapUnit($list,$units) {
$ul=count($units);
$xs=array();
foreach (array_reverse($list) as $x) {
$l=count($xs);
if ($x!="0" || !($l%4))
$n=($x=='0'?'':$x).($units[($l-1)%$ul]);
else $n=is_numeric($xs[0][0])?$x:'';
array_unshift($xs,$n);
}
return $xs;
}
//上传文件
public function upload_file($info){
/* $zip = new \ZipArchive();
if ($zip->open($info, ZipArchive::OVERWRITE) === TRUE) {
addFileToZip("Uploads", $zip);
$zip->close();
}*/
/*header("Cache-Control: public");
header("Content-Description: File Transfer"); */
header('Content-disposition: attachment; filename='.preg_replace('/^.+[\\\\\\/]/', '',$info)); //文件名
header("Content-Type: application/png"); //zip格式的
header("Content-Transfer-Encoding: binary"); //告诉浏览器,这是二进制文件
header('Content-Length: '. filesize($info)); //告诉浏览器,文件大小
@readfile($info);
}