1.上傳一個(gè).xlsx文件,服務(wù)器端解析文件,用phpExcel讀取excel中內(nèi)容,打印其中內(nèi)容,只顯示了一行數(shù)據(jù)中的一個(gè),其他都沒有顯示2.html代碼: <form name="form1" id="form1">
<p><input type="file" id="excelImport" value="" name="excelImport"></p>
<p><input type="button" name="b1" value="submit" onclick="fsubmit()" /></p>
</form>
js代碼:
function fsubmit(){
var form=document.getElementById("form1");
var fd =new FormData(form);
console.log(fd);
$.ajax({
url: "/module/library/control/batch_insert?_token={{csrf_token()}}",
type: "POST",
data: fd,
processData: false, // 告訴jQuery不要去處理發(fā)送的數(shù)據(jù)
contentType: false, // 告訴jQuery不要去設(shè)置Content-Type請(qǐng)求頭
success: function(response,status,xhr){
console.log(response);
}
});
return false;
}
php代碼:
public function batch_insert()
{
$file = $_FILES['excelImport']['tmp_name'];
$file = iconv('UTF-8', 'GBK',$file);
var_dump($file);
\Excel::load($file, function($reader) {
$data = $reader->toArray();
var_dump($data);
});
}
3.
4.只顯示了人員照片1,其他的姓名啥的都沒顯示,不知道為啥。
phpExcel打印數(shù)據(jù)問題
喵喵時(shí)光機(jī)
2019-03-17 20:36:11