本文整理匯總了PHP中Yii::enableIncludePath方法的典型用法代碼示例。如果您正苦於以下問題:PHP Yii::enableIncludePath方法的具體用法?PHP Yii::enableIncludePath怎麽用?PHP Yii::enableIncludePath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Yii
的用法示例。
在下文中一共展示了Yii::enableIncludePath方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createConsoleYiiApp
public function createConsoleYiiApp()
{
require dirname(__FILE__) . '/../../vendor/autoload.php';
$config = (require dirname(__FILE__) . '/../../protected/config/console-test.php');
\Yii::$enableIncludePath = false;
if (!\Yii::app()) {
\Yii::createConsoleApplication($config);
}
}
示例2: actionServe
/**
* Serve files.
*/
public function actionServe()
{
Yii::$enableIncludePath = false;
// preload CFileHelper before disabling Yii autoload
$tmp = CFileHelper::getExtension('');
$tmp = CLogger::LEVEL_ERROR;
//@YiiBase::autoload('CHttpException');
//@YiiBase::autoload('CExceptionEvent');
spl_autoload_unregister(array('YiiBase', 'autoload'));
require dirname(dirname(__FILE__)) . '/vendors/minify/min/index.php';
}
示例3: actionExportServiceCharge
/**
*
* 導出訂單數據服務費報表
*
*/
public function actionExportServiceCharge()
{
header("Content-Type:text/html;charset=GB2312");
Yii::$enableIncludePath = false;
Yii::import('application.extensions.PHPExcel.PHPExcel', 1);
$obj_phpexcel = new PHPExcel();
$dataserviceModel = new DataServiceFeeModel();
$getData = $this->_get();
$time = date('F/d', time());
//echo $getData['start-time'];
$whereSql = '';
if ($getData['platform_type'] != '0') {
$whereSql .= "AND ORDERTYPE = '" . $getData['platform_type'] . "'";
}
if (strlen($getData['gbillno']) > 0) {
$whereSql .= "AND GENERALBILLNO LIKE '%" . $getData['gbillno'] . "%'";
}
if (strlen($getData['start-time']) > 0) {
$whereSql .= " AND TO_CHAR(REALARRIVALDATE, 'YYYY-MM-DD HH24:MI:SS') > '" . $getData['start-time'] . " 00:00:00'";
}
if (strlen($getData['end-time']) > 0) {
$whereSql .= " AND TO_CHAR(REALARRIVALDATE, 'YYYY-MM-DD HH24:MI:SS') < '" . $getData['end-time'] . " 24:00:00'";
}
$data = $dataserviceModel->getNowhereList($whereSql);
foreach ($data as &$val) {
$val['price'] = $getData['charge'];
$val['charge'] = $val['NUM'] * $getData['charge'];
}
$opexcel = new OperateExcel();
$opexcel = PHPExcel_IOFactory::load(Yii::app()->basePath . '\\tmp\\temp\\ServiceFeeTemplate.xlsx');
$writer = PHPExcel_IOFactory::createWriter($opexcel, 'Excel5');
$this->actionDoExport('OK', $opexcel->getSheet(1));
$sheet1 = $opexcel->getSheet(0);
//設置sheet標題
$sheet1->setTitle("Debit note");
//設置客戶資料
$sheet1->getCell('A10')->setValue($getData['platform_type']);
//設置日期
$sheet1->getCell('F7')->setValue($time);
$roll = 14;
$styleThinBlackBorderOutline = array('borders' => array('outline' => array('style' => PHPExcel_Style_Border::BORDER_THIN, 'color' => array('argb' => 'FF000000'))));
//金額
$price = 0;
//總數
$countnum = 0;
foreach ($data as $res) {
$price += intval($res['charge']);
$countnum += intval($res['NUM']);
}
//設置數量
$sheet1->getCell('D15')->setValue($countnum);
//設置單價
$sheet1->getCell('E15')->setValue($getData['charge']);
//設置總價
$sheet1->getCell('F15')->setValue($countnum * $getData['charge']);
/* foreach($data as $key=>$res){
$roll++;
//合並單元格
$sheet1->mergeCells("B{$roll}:C{$roll}");
//設置字體
$sheet1->getStyle("A{$roll}:F{$roll}")->getFont()->setName('宋體');
$sheet1->getStyle("A{$roll}:F{$roll}")->getFont()->setSize(8);
$sheet1->getStyle("A{$roll}:F{$roll}")->getFont()->setBold(true);
$sheet1->getStyle("A{$roll}:F{$roll}")->getFont()->getColor()->setRGB('0000');
//序號
$sheet1->setCellValueByColumnAndRow(0,$roll,$key+1);
//收費項目
$sheet1->setCellValueByColumnAndRow(1,$roll,'數據處理費');
//數量
$sheet1->setCellValueByColumnAndRow(3,$roll,$res['NUM']);
//單價
$sheet1->setCellValueByColumnAndRow(4,$roll,'¥'.number_format($res['price'],2));
//金額
$sheet1->setCellValueByColumnAndRow(5,$roll,'¥'.number_format($res['charge'],2));
$price += intval($res['charge']);
$sheet1->setCellValueByColumnAndRow(5,$roll+1,$price);
//設置邊框
$sheet1->getStyle("A{$roll}")->applyFromArray($styleThinBlackBorderOutline);
$sheet1->getStyle("B{$roll}:C{$roll}")->applyFromArray($styleThinBlackBorderOutline);
$sheet1->getStyle("D{$roll}")->applyFromArray($styleThinBlackBorderOutline);
$sheet1->getStyle("E{$roll}")->applyFromArray($styleThinBlackBorderOutline);
$sheet1->getStyle("F{$roll}")->applyFromArray($styleThinBlackBorderOutline);
//生成一行
$sheet1->insertNewRowBefore($roll+1,1);
}
//刪除一行
$sheet1->removeRow($roll+1,1); */
$filename = uniqid() . '.xls';
$file_name = "順益訂單服務費(" . $getData['platform_type'] . "_" . $getData['start-time'] . "_" . $getData['end-time'] . ")";
$show_name = "{$file_name}.xls";
$write1 = PHPExcel_IOFactory::createWriter($opexcel, 'Excel5');
$write1->save($filename);
//解決亂碼
ob_end_clean();
//.........這裏部分代碼省略.........
示例4: dirname
<?php
//include('compressor.php');
date_default_timezone_set('Asia/Ho_Chi_Minh');
error_reporting(E_ALL);
//ini_set('display_errors', '1');
// change the following paths if necessary
// error_reporting(E_ALL);
$yii = dirname(__FILE__) . '/framework/yii.php';
$config = dirname(__FILE__) . '/protected/config/main.php';
// remove the following lines when in production mode
defined('YII_DEBUG') or define('YII_DEBUG', true);
// specify how many levels of call stack should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 3);
require_once $yii;
Yii::$enableIncludePath = false;
Yii::createWebApplication($config)->run();
示例5: actionAlertaFinalizaPresubasta
public function actionAlertaFinalizaPresubasta()
{
Yii::$enableIncludePath = false;
//
//list($MailController) = Yii::app()->createController('Mail');
//$MailController->mailsend();
$arreglo = array();
$criteria = new CDbCriteria();
// Verificar
// Existe una subasta silenciosa activa?
$criteria = new CDbCriteria();
$criteria->condition = 'silenciosa=:silenciosa';
$criteria->params = array(':silenciosa' => 1);
$subas = Subastas::model()->find($criteria);
if ($subas == null) {
//Tomo ultima silenciosa
$criteria->condition = 'fuesilenciosa=:fuesilenciosa';
$criteria->params = array(':fuesilenciosa' => 1);
$criteria->order = 'id DESC';
$silenciosa = Subastas::model()->find($criteria);
// Ya fue enviado los correos masivos.
if ($silenciosa->envio_correos_pre) {
return;
}
// Pre Subasta
$actualTime = new DateTime("now");
$intervaloPresubasta = $actualTime->getTimestamp() - $silenciosa->fechaPresubasta()->getTimestamp();
// Verificando que se encuentra en los proximos 10 minutos al finalizar la subasta.
if (!($intervaloPresubasta >= 0 && $intervaloPresubasta <= 600)) {
return;
}
} else {
return;
}
$footer = Correos::model()->find('id=:id', array('id' => 1));
//construyo el titulo del mensaje
$subject = $silenciosa['nombre'] . ' ' . $silenciosa['nombrec'] . ' en vivo inicia en una hora';
//obtengo los resultados de las obras en la subasta finalizada.
//$imagenes = ImagenS::model()->findAll('ids=:ids', array(':ids' => $silenciosa['id']));
$criteria = new CDbCriteria();
$criteria->distinct = true;
$criteria->condition = "ids=" . $silenciosa->id;
$criteria->select = 'id_usuario, ids';
$imagenes = ImagenS::model()->findAll($criteria);
$message = "";
//echo $silenciosa['nombre'];
//echo "Hola";
foreach ($imagenes as $key => $value) {
//valido que la obra la tenga un usuario y q no vuelva a entrar ese mismo usuario
/*
if($value->id_usuario and !in_array($value->id_usuario, $arreglo))
{*/
$usuario = Usuarios::model()->find('id=:id', array(':id' => $value->id_usuario));
$usuariospuja = Usuariospujas::model()->find('idusuario=:idusuario and idsubasta=:idsubasta', array(':idusuario' => $usuario['id'], ':idsubasta' => $silenciosa['id']));
if (!$usuariospuja) {
continue;
}
$correo = $usuario['email'];
$nombre = $usuario['nombre'];
$apellido = $usuario['apellido'];
$paleta = $usuariospuja['paleta'];
$to = $correo;
$message .= '<h2> Las obras a las que no dejo puja quedan hasta ahí. Haga click aquí para ir a <a href="' . Yii::app()->request->baseUrl . '">Subastas Odalys </a></h2>';
$message = '
<h2 style="padding-bottom:5px !important; font-size:14px !important;">Estimado(a) ' . strtoupper($nombre) . ' ' . strtoupper($apellido) . ', la Pre-' . $silenciosa['nombre'] . ' ' . $silenciosa['nombrec'] . ' ha finalizado a las 5:00 p.m. del día de hoy.</h2>
<h2 style="padding-bottom:10px !important; font-size:14px !important;">Hasta el momento Ud. tiene la última puja de los siguientes lotes:</h2><br/>
<table width="100%">
<thead>
<tr>
<th align="left" style="width: 200px;">LOTE</th>
<th align="left">ÚLTIMA PUJA</th>
</tr>
</thead>
<tbody>';
//$arreglo[] = $value->id_usuario;
$usuarios = ImagenS::model()->findAll('id_usuario=:id_usuario and ids=:idsubasta', array(':id_usuario' => $value->id_usuario, ':idsubasta' => $silenciosa['id']));
// Lista de imágenes del usuario.
foreach ($usuarios as $ky => $valor) {
$message .= '<tr>
<td align="left" style="width: 200px;">
<!--<img src="http://www.odalys.com/odalys/' . $valor->imagen . '" style="float:left;padding-right:20px;"/>-->
' . $valor->descri . '
</td>';
$message .= '
<td align="center">' . $silenciosa['moneda'] . ' ' . number_format($valor->actual) . '</td>
</tr>';
}
$message .= '</tbody>
</table>
<hr>';
$message .= '<h2 style="padding-bottom:10px !important; font-size:14px !important;">
Le recordamos que si no seleccioó alguna de las opciones para los lotes mencionados anteriormente, asumiremos que
desea quedarse con su puja actual, en este caso su última puja de la presubasta va a ser tomada como su última oferta en el lote, es decir, el lote será subastado en la sala desde ese monto.
<br><br>
Recuerde que la Subasta 237 Maestros Venezolanos, se realizará hoy domingo 29 de noviembre a las 11:00 a.m. en el Hotel JW Marriott Caracas. Salón Armando Reverón. Av. Venezuela con calle Mohedano. El Rosal. Caracas.
<br><br>
Ante cualquier duda, por favor póngase en contacto con nosotros.
//.........這裏部分代碼省略.........
示例6: exportSheetExcel
/**
* 生成多個sheet的excel
*/
public function exportSheetExcel($listArr1 , $listArr2 , $headArr1 , $headArr2){
//if(!$listArr || !$headArr) return false;
set_time_limit(0);
// 關閉YII的自動加載功能,改用手動加載,否則會出錯,PHPExcel有自己的自動加載功能
Yii::$enableIncludePath=false;
/*引入PHPExcel.php文件*/
Yii::import('application.extensions.PHPExcel.PHPExcel', 1);
$obj_phpexcel = new PHPExcel();
$obj_phpexcel->setActiveSheetIndex(0); //設置第一個工作表為活動工作表
$obj_phpexcel->getActiveSheet()->setTitle('orderhead'); //設置工作表名稱
$objActSheet = $obj_phpexcel->getActiveSheet();
//設置字體
$objActSheet->getDefaultStyle()->getFont()->setName('微軟雅黑');
//設置字體大小
$objActSheet->getDefaultStyle()->getFont()->setSize(9);
//設置自動行高
$objActSheet->getDefaultRowDimension()->setRowHeight(15);
$key = 0;
$keyArr = array();
foreach($headArr1 as $v){
$index = PHPExcel_Cell::stringFromColumnIndex($key);
$keyArr[] = $index;
//設置頁頭填充色
$objStyle = $objActSheet ->getStyle($index.'1');
$objFill = $objStyle->getFill();
$objFill->setFillType(PHPExcel_Style_Fill::FILL_SOLID);
$objFill->getStartColor()->setARGB('#FFFF00');
//設置頁頭邊框色
$objBorder = $objStyle->getBorders();
$objBorder->getTop()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
$objBorder->getBottom()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
$objBorder->getLeft()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
$objBorder->getRight()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
//設置自動列寬
$objActSheet->getColumnDimension($index)->setAutoSize(true);
//設置對其方式
$objAlign = $objStyle->getAlignment();
$objAlign->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objAlign->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$obj_phpexcel->setActiveSheetIndex(0)->setCellValue($index.'1' , $v);
$key++;
}
$keyWordArr = CDict::$title_key_word;
$keyWordArr2 = CDict::$title_hscode_word;
$key2 = 2;
foreach($listArr1 as $l_key =>$info){ //行寫入
$key3 = 0;
foreach($info as $c_key=>$value){// 列寫入
$span = $keyArr[$key3];
// $objStyle = $objActSheet ->getStyle($span.$key2);
// $objStyle->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER);
//設置單元格避免大數字科學計數顯示
// if(in_array($c_key, array('ORDERCOMMITTIME','PAY_TIME','USER_ID','IDENTIFY_CODE'))){
// $objStyle = $objActSheet ->getStyle($span.$key2);
// $objStyle->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER);
// }
//$objActSheet->setCellValue($span.$key2, $value);
if(is_numeric($value) && $c_key != 'TRX_SERIAL_NO' && $c_key!='IDENTIFY_CODE' && $c_key!='USER_ID' && $c_key != 'GOODNO' && $c_key != 'HSCODE' && $c_key != 'RECEIVEZIPCODE' && $c_key != 'RECZIP' && $c_key != 'MERCHANTORDERID'){
$objStyle = $objActSheet ->getStyle($span.$key2);
if(strpos($value,'.')){
$objStyle->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER_00);
}else{
$objStyle->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER);
}
$objActSheet->setCellValue($span.$key2,$value);
}else{
$objActSheet->setCellValueExplicit($span.$key2,$value,PHPExcel_Cell_DataType::TYPE_STRING);
}
//$objActSheet->setCellValueExplicit($span.$key2,$value,PHPExcel_Cell_DataType::TYPE_STRING);
$key3++;
}
$key2++;
}
//創建第二個工作表
$newWorkSheet = new PHPExcel_Worksheet($obj_phpexcel, 'orderlist'); //創建一個工作表
$obj_phpexcel->addSheet($newWorkSheet); //插入工作表
$obj_phpexcel->setActiveSheetIndex(1); //切換到新創建的工作表
$objActSheet1 = $obj_phpexcel->getActiveSheet();
//設置字體
$objActSheet1->getDefaultStyle()->getFont()->setName('微軟雅黑');
//設置字體大小
$objActSheet1->getDefaultStyle()->getFont()->setSize(9);
//設置自動行高
$objActSheet1->getDefaultRowDimension()->setRowHeight(15);
$key = 0;
$keyArr = array();
foreach($headArr2 as $v){
$index = PHPExcel_Cell::stringFromColumnIndex($key);
$keyArr[] = $index;
//設置頁頭填充色
$objStyle = $objActSheet1 ->getStyle($index.'1');
$objFill = $objStyle->getFill();
$objFill->setFillType(PHPExcel_Style_Fill::FILL_SOLID);
$objFill->getStartColor()->setARGB('#FFFF00');
//.........這裏部分代碼省略.........
示例7: import
/**
* Imports a class or a directory.
* Overrides {@link YiiBase::import()} to check in /custom for all imported classes
*
* @param string $alias path alias to be imported
* @param boolean $forceInclude whether to include the class file immediately. If false, the class file
* will be included only when the class is being used. This parameter is used only when
* the path alias refers to a class.
* @return string the class name or the directory that this alias refers to
* @throws CException if the alias is invalid
*/
public static function import($alias, $forceInclude = false)
{
if (isset(self::$_imports[$alias])) {
// previously imported
return self::$_imports[$alias];
}
if (class_exists($alias, false) || interface_exists($alias, false)) {
return self::$_imports[$alias] = $alias;
}
if (($pos = strrpos($alias, '\\')) !== false) {
$namespace = str_replace('\\', '.', ltrim(substr($alias, 0, $pos), '\\'));
if (($path = self::getPathOfAlias($namespace)) !== false) {
$classFile = $path . DIRECTORY_SEPARATOR . substr($alias, $pos + 1) . '.php';
if ($forceInclude) {
if (is_file($classFile)) {
require self::getCustomPath($classFile);
} else {
throw new CException(Yii::t('yii', 'Alias "{alias}" is invalid. Make sure it points to an existing PHP file.', array('{alias}' => $alias)));
}
self::$_imports[$alias] = $alias;
} else {
self::$classMap[$alias] = $classFile;
}
return $alias;
} else {
throw new CException(Yii::t('yii', 'Alias "{alias}" is invalid. Make sure it points to an existing directory.', array('{alias}' => $namespace)));
}
}
if (($pos = strrpos($alias, '.')) === false) {
if ($forceInclude && self::x2_autoload($alias)) {
self::$_imports[$alias] = $alias;
}
return $alias;
}
$className = (string) substr($alias, $pos + 1);
$isClass = $className !== '*';
if ($isClass && (class_exists($className, false) || interface_exists($className, false))) {
return self::$_imports[$alias] = $className;
}
if (($path = self::getPathOfAlias($alias)) !== false) {
if ($isClass) {
if ($forceInclude) {
if (is_file($path . '.php')) {
require self::getCustomPath($path . '.php');
} else {
throw new CException(Yii::t('yii', 'Alias "{alias}" is invalid. Make sure it points to an existing PHP file.', array('{alias}' => $alias)));
}
self::$_imports[$alias] = $className;
} else {
self::$classMap[$className] = $path . '.php';
}
return $className;
} else {
if (self::$_includePaths === null) {
self::$_includePaths = array_unique(explode(PATH_SEPARATOR, get_include_path()));
if (($pos = array_search('.', self::$_includePaths, true)) !== false) {
unset(self::$_includePaths[$pos]);
}
}
array_unshift(self::$_includePaths, $path);
if (self::$enableIncludePath && set_include_path('.' . PATH_SEPARATOR . implode(PATH_SEPARATOR, self::$_includePaths)) === false) {
self::$enableIncludePath = false;
}
return self::$_imports[$alias] = $path;
}
} else {
throw new CException(Yii::t('yii', 'Alias "{alias}" is invalid. Make sure it points to an existing directory or file.', array('{alias}' => $alias)));
}
}
示例8: actionServe
/**
* Serve files.
*/
public function actionServe()
{
Yii::$enableIncludePath = false;
require dirname(dirname(__FILE__)) . '/vendors/minify/min/index.php';
}
示例9: registerAutoloader
/**
* Registers a new class autoloader.
* The new autoloader will be placed before {@link autoload} and after
* any other existing autoloaders.
* @param callback $callback a valid PHP callback (function name or array($className,$methodName)).
* @param boolean $append whether to append the new autoloader after the default Yii autoloader.
* Be careful using this option as it will disable {@link enableIncludePath autoloading via include path}
* when set to true. After this the Yii autoloader can not rely on loading classes via simple include anymore
* and you have to {@link import} all classes explicitly.
*/
public static function registerAutoloader($callback, $append = false)
{
if ($append) {
self::$enableIncludePath = false;
spl_autoload_register($callback);
} else {
spl_autoload_unregister(array('Yii', 'autoload_1'));
spl_autoload_register($callback);
spl_autoload_register(array('Yii', 'autoload_1'));
}
}
示例10: actionPollRating
public function actionPollRating()
{
$orderIds = trim(Yii::app()->request->getParam('orderIds'));
//獲取數據
$data = PollRating::model()->getExportData($orderIds);
//獲取附件
$attachments = FileUpload::model()->getFiles($orderIds);
$pics = array();
foreach ($attachments as $value) {
$pics[$value['orderid']][] = $value['file_path'];
}
Yii::$enableIncludePath = false;
//Yii::import('application.extension.PHPExcel', 1);
$objPHPExcel = new PHPExcel();
// Add some data
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1', '處理日期')->setCellValue('B1', '產品類型')->setCellValue('C1', '開始時間')->setCellValue('D1', '結束時間')->setCellValue('E1', '處理時間')->setCellValue('F1', '賬號')->setCellValue('G1', '訂單號')->setCellValue('H1', '申請服務')->setCellValue('I1', '具體內容')->setCellValue('J1', '問題描述')->setCellValue('K1', '處理情況')->setCellValue('L1', '備注')->setCellValue('M1', '處理人員')->setCellValue('N1', '附件');
//最多支持5張附件圖片
$picColumn = array('N', 'O', 'P', 'Q', 'R');
$i = 2;
foreach ($data as $value) {
$endTime = empty($value["updatetime"]) ? time() : strtotime($value["updatetime"]);
$startTime = empty($value["intitime"]) ? 0 : strtotime($value["intitime"]);
$subTime = $endTime - $startTime;
$remark = "";
$res = unserialize(base64_decode($value['content']));
$remarkKey = mb_convert_encoding('備注_', 'GBK', 'UTF8');
if (isset($res[$remarkKey])) {
$remark = mb_convert_encoding($res[$remarkKey], 'UTF8', 'GBK');
}
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A' . $i, strstr($value["intitime"], ' ', true))->setCellValueExplicit('B' . $i, mb_convert_encoding($value['game_name'], 'UTF8', 'GBK'), PHPExcel_Cell_DataType::TYPE_STRING)->setCellValue('C' . $i, trim(strstr($value["intitime"], ' ')))->setCellValueExplicit('D' . $i, $value['updatetime'], PHPExcel_Cell_DataType::TYPE_STRING)->setCellValueExplicit('E' . $i, $subTime, PHPExcel_Cell_DataType::TYPE_STRING)->setCellValue('F' . $i, $value['consumeraccount'])->setCellValueExplicit('G' . $i, $value['ordernum'], PHPExcel_Cell_DataType::TYPE_STRING)->setCellValue('H' . $i, $value['typename'])->setCellValue('I' . $i, $value['typedetail'])->setCellValueExplicit('J' . $i, $remark, PHPExcel_Cell_DataType::TYPE_STRING)->setCellValue('K' . $i, mb_convert_encoding($value['status'], 'UTF8', 'GBK'))->setCellValue('L' . $i, mb_convert_encoding($value['remark'], 'UTF-8', 'GBK'))->setCellValue('M' . $i, mb_convert_encoding($value['username'], 'UTF8', 'GBK'));
//圖片
if (isset($pics[$value['orderid']])) {
foreach ($pics[$value['orderid']] as $key => $pic) {
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setPath(_PATH_UPLOAD . DIRECTORY_SEPARATOR . $pic);
$objDrawing->setCoordinates($picColumn[$key] . $i);
$objDrawing->setName($pic);
$objDrawing->setHeight(60);
$objDrawing->setWidth(60);
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
}
}
//設置行高
$objPHPExcel->getActiveSheet()->getRowDimension($i)->setRowHeight(30);
$i++;
}
$filename = mb_convert_encoding('所有接待日誌', 'GBK', 'UTF8') . date('YmdHis');
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="' . $filename . '.xls"');
header('Cache-Control: max-age=0');
// If you're serving to IE 9, then the following may be needed
header('Cache-Control: max-age=1');
// If you're serving to IE over SSL, then the following may be needed
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
// Date in the past
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
// always modified
header('Cache-Control: cache, must-revalidate');
// HTTP/1.1
header('Pragma: public');
// HTTP/1.0
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;
}