Laravel-Excel2.1 导出:Uninitialized string offset: 1
###保存提示行数内容
//echo 'Initial character of expression block is '.$opCharacter, PHP_EOL;
if ((isset(self::$comparisonOperators[$opCharacter])) && (strlen($formula) > $index) && (isset(self::$comparisonOperators[$formula{$index+1}]))) {
$opCharacter .= $formula{++$index};
//echo 'Initial character of expression block is comparison operator '.$opCharacter.PHP_EOL;
}
$date = date('ymdHis');
//创建文件
$fileName = 'single_result'.$date;
$format = 'csv';
$alias = '匹配结果'.$date.'.xls';
Excel::create($fileName,function($excel) {
//创建工作表
$excel->sheet('score', function($sheet) {
$sheet->setColumnFormat(array(
'D' => '@',
'G' => '@',
'H' => '@',
'L' => '@',
'N' => '@'
));
//分块获取数据
OwcpMatchresult::with([
'user'
'cp' ,
])->where('type','single_normal')->orderBy('managerid')->chunk(300, function ($result) use($sheet) {
//单身异性 single_normal 单身同性single_homosex
$list = $result->toArray();
$data =[];
foreach($list as $key => $user)
{
$room = [
$user['managerid'],
$user['num'],
];
if($user['user'])
{
$data []= array_merge($room,$user['user']);
}else{
$data[] = $room;
}
if($user['cp'])
{
$data []= array_merge($room,$user['cp']);
}else{
$data[] = $room;
}
}
//多行追加
$sheet->rows($data);
});
});
})->store($format);
导出数量少时并没有问题,想知道数量多的情况下有什么需要注意修改的地方吗?
已经这个问题有没有大佬帮忙看下怎么解决才好
用户昵称存在表情或个别符合导致生成csv文件失败,目前先过滤所有符号