本文整理汇总了PHP中PHPExcel_Shared_File::setUseUploadTempDirectory方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Shared_File::setUseUploadTempDirectory方法的具体用法?PHP PHPExcel_Shared_File::setUseUploadTempDirectory怎么用?PHP PHPExcel_Shared_File::setUseUploadTempDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPExcel_Shared_File
的用法示例。
在下文中一共展示了PHPExcel_Shared_File::setUseUploadTempDirectory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: file_to_obj_php_excel
function file_to_obj_php_excel($inputFileName)
{
$CI =& get_instance();
PHPExcel_Shared_File::setUseUploadTempDirectory(true);
if ($CI->config->item('spreadsheet_format') == 'XLSX') {
$objReader = new PHPExcel_Reader_Excel2007();
} else {
$objReader = new PHPExcel_Reader_CSV();
PHPExcel_Cell::setValueBinder(new TextValueBinder());
}
$objReader->setReadDataOnly(true);
$objPHPExcel = $objReader->load($inputFileName);
return $objPHPExcel;
}
示例2: export
public function export()
{
if ($this->request->server['REQUEST_METHOD'] == 'POST') {
ini_set('display_errors', 1);
error_reporting(E_ERROR | E_PARSE);
$this->load->model('module/product_option_image_pro');
$data = $this->model_module_product_option_image_pro->getAllImages();
require_once $this->PHPExcelPath();
/*
PHPExcel_CachedObjectStorageFactory::cache_in_memory;
PHPExcel_CachedObjectStorageFactory::cache_in_memory_serialized;
PHPExcel_CachedObjectStorageFactory::cache_in_memory_gzip;
PHPExcel_CachedObjectStorageFactory::cache_to_discISAM;
PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp;
PHPExcel_CachedObjectStorageFactory::cache_to_apc;
PHPExcel_CachedObjectStorageFactory::cache_to_memcache
PHPExcel_CachedObjectStorageFactory::cache_to_wincache;
PHPExcel_CachedObjectStorageFactory::cache_to_sqlite;
PHPExcel_CachedObjectStorageFactory::cache_to_sqlite3;
*/
PHPExcel_Shared_File::setUseUploadTempDirectory(true);
$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_discISAM;
//PHPExcel_CachedObjectStorageFactory::cache_to_discISAM ; //
$cacheSettings = array('memoryCacheSize' => '32MB');
if (!PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings)) {
$this->log->write("Product Options Images PRO: PHPExcel cache error");
}
$objPHPExcel = new PHPExcel();
$objPHPExcel->setActiveSheetIndex(0);
/*
$column = 0;
foreach ($data as $data_key => $data_val) {
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column, 1, $data_key);
$column++;
}
*/
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, 1, 'product_id');
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1, 1, 'option_value_id');
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(2, 1, 'image');
$objPHPExcel->getActiveSheet()->fromArray($data, null, 'A2');
unset($data);
//$objPHPExcel->getActiveSheet()->fromArray($current_data, null, 'A2');
//$objPHPExcel->getActiveSheet()->fromArray($data,null,'A2');
$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
$file = DIR_CACHE . "/poip_export.xls";
$objWriter->save($file);
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' . basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
// читаем файл и отправляем его пользователю
readfile($file);
exit;
}
}