Beispiel #1
0
 public static function ExportToXls($arr, $file_name = null, $is_fullname = false, $expand_name = 'xls', $path = null, $is_model = false, $is_output = false)
 {
     set_time_limit(36000000);
     if (!$expand_name || $expand_name == '') {
         $expand_name = 'xls';
     }
     if (strtolower($expand_name) != 'xls' && strtolower($expand_name) != 'pdf') {
         $expand_name = 'xls';
     }
     if ($is_fullname && $file_name && $file_name != '') {
     } else {
         if (!$file_name) {
             $file_name = 'Export' . date('-ymd-His', time());
         } else {
             $file_name = $file_name . date('-ymd-His', time());
         }
         //防止重名
         $guid = Watt_Util_Utils::getGuId();
         $file_name .= '-' . substr($guid, 0, 8);
     }
     if ($path) {
         if (!$is_model) {
             $new_path = $path . $file_name . "." . $expand_name;
         }
     } else {
         $new_path = Watt_Config::getUploadPath() . $file_name . "." . $expand_name;
     }
     //输出的路径
     $out_path = Watt_Config::getSiteRoot() . "upload/" . $file_name . "." . $expand_name;
     if ($is_model) {
         self::getXlsByModel($arr, $path, $new_path, $file_name, $expand_name, $is_output);
     } else {
         self::getXlsPathByArr($arr, $new_path, $file_name, $expand_name, $is_output);
     }
     return $out_path;
 }