Rumah > Soal Jawab > teks badan
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<body>
<?php
$r1r = meletup(", ",$_POST['ypname']);
$r2r = meletup(",",$_POST['guige']);
$r3r = meletup(",",$_POST['shengcan'] );
$r4r = meletup(",",$_POST['danwei']);
$r5r = meletup(",",$_POST['pihao']);
$r6r = meletup(" ,",$_POST['bz']);
$r7r = meletup(",",$_POST['rq']);
$r8r = meletup(",",$_POST['djlx'] );
$r9r = meletup(",",$_POST['rk']);
$rwr = meletup(",",$_POST['ch']);
$data2 = array_merge($r1r,$r2r);
var_dump ($data2);
/**
* Eksport data
* @param array $tajuk Nama baris tajuk
* @param array $data Eksport data
* @param string $fileName Nama fail
* @param string $savePath Simpan laluan
*param $type Sama ada untuk memuat turun false--save true--muat turun
* @return string Kembalikan laluan penuh fail
* @throws PHPExcel_Exception
* @throws PHPExcel_Reader_Exception
*/
$title = array("Nama Produk","Spesifikasi","Pengilang","Unit" ,"Nombor batch","Catatan","Tarikh","Jenis dokumen","Kuantiti masuk","Kuantiti penghantaran");
$type = true;
$data = r1r;
$ FileName = 'bflxexc';
function exportExcel($title=array(), $data=array(), $fileName='', $savePath='./', $isDown=false){
include(' PHPExcel .php');
$obj = PHPExcel();
//Pengenalpastian sel mendatar
$cellName = array('A', 'B', 'C', 'D', ' E' , 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q' , ' R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'AA', 'AB', 'AC', ' AD' , 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM', 'AN', 'AO', 'AP' , ' AQ', 'AR', 'AS', 'AT', 'AU', 'AV', 'AW', 'AX', 'AY', 'AZ');
$obj-> ;getActiveSheet (0)->setTitle('bflx'); //Tetapkan nama helaian
$_row = 1; //Tetapkan pengecam sel menegak
if($title){
$_cnt = count($ title );
$obj->getActiveSheet(0)->mergeCells('A'.$_row.':'.$cellName[$_cnt-1].$_row); //Gabungkan sel
$obj-> ; setActiveSheetIndex(0)->setCellValue('A'.$_row, '$r1r'.date('Y-m-d H:i:s')); //Tetapkan kandungan sel yang digabungkan
$_row++;
$i = 0;
foreach($title AS $v){ //Tetapkan tajuk lajur
$obj->setActiveSheetIndex(0)->setCellValue($cellName[$i].$_row, $v );
$i++;
}
$_row++;
}
//Isi data
jika($data){
) $i = 0;
untuk $_v setiap { $j = 0; foreach($_v SEBAGAI $_sel){ $obj->getActiveSheet(0)->setCellValue($cellName[$j] . ($i+$_row), $ _sel); $j++; } $i++; } } //Pemprosesan nama fail jika(!$nama fail) = . nama fail
qid(masa() ,true); } $objWrite = PHPExcel_IOFactory::createWriter($obj, 'Excel2007'); if($isDown){ //Muat turun halaman web'🜎 ); header("Content-Disposition:attachment;filename=$fileName.xls"); $objWrite->save('php://output');exit; } $ _fileName = iconv("utf-8", "gb2312", $fileName); //Transcoding $_savePath = $savePath.$_fileName.'.xlsx'; $objWrite->save($_savePath ); kembalikan $savePath.$fileName.'.xlsx';} //exportExcel(array('name','age'), array(array('a',21),array (' b',23)), 'Fail', './', benar); ?> </body> <?php ?>// The array belum ditukar lagi, tetapi mengapa tiada gesaan untuk memuat turun?