_charset($fileName);
header("Content-Type: application/vnd.ms-excel; charset=gbk");
header("Content-Disposition: inline; filename=\"" . $fileName . ".xls\"");
echo "\n
";
echo "\n\n\n";
$Column = 0;
foreach($width_data as $v){
$Column++;
if(empty($v)){
continue;
}
echo "\n";
}
$guard = 0;
foreach($data as $v)
{
$guard++;
if($guard==$this->limit)
{
ob_flush();
flush();
$guard = 0;
}
echo $this->_addRow($this->_charset($v));
}
echo "
\n\n";
}
private function _addRow($row)
{
$cells = "";
foreach ($row as $k => $v)
{
$cells .= "" . $v . " | \n";
}
return "\n" . $cells . "
\n";
}
private function _charset($data)
{
if(!$data)
{
return false;
}
if(is_array($data))
{
foreach($data as $k=>$v)
{
$data[$k] = $this->_charset($v);
}
return $data;
}
return iconv('utf-8', 'gbk', $data);
}
}