我正在使用这个包用Laravel生成excel文档:https://github.com/Maatwebsite/Laravel-Excel然后显示存储图像。
Laravel excel文件不显示存储图像如何显示我的代码存储图像。
foreach($ order ['details']为$ value){
$test_processes = DB::table('test_processes')->join('process_items', 'test_processes.item_id', '=', 'process_items.id')->select('process_items.name','process_items.image')->where('test_id','=',$value->test_id)->get();
$order_id = $value->order_id;
$data[] = array(
'parameter' => $value['parameter'],
'state' => $value['state'],
'method_type' => $value['method'],
'method' => $value['test_method'],
'sampling' => '',
'Analysis' => '',
'quantity' => $value['quantity']
);
foreach($test_processes as $item){
$data[0][$item->name] = $item->name.' '.$item->image.'<td><img src="'.$item->image.'" /></td>';
}
}
Excel::create('job_pack', function($excel) use($data,$order_id){
$excel->sheet('Sheet1', function($sheet) use($data,$order_id) {
$head = array(
'Parameter',
'State',
'Method type',
'Test Method',
'Sampling',
'Analysis',
'quantity',
'Kit && Image'
);
$sheet->fromArray($head, null, 'A1', false, false);
$r = 2;
foreach($data as $val){
$sheet->row($r,$val);
$r++;
}
});
})->store('xls', storage_path('excel/'.$order_id));