|
|
直爽的黄花菜 · Excel - Tableau· 2 月前 · |
|
|
坚强的馒头 · phpexcel 一些基本设置总结 - ...· 4 周前 · |
|
|
英姿勃勃的火柴 · find -exec 命令后面的\;和+ ...· 1 年前 · |
|
|
火星上的冲锋衣 · Python3.7 ElementTree ...· 1 年前 · |
|
|
乐观的机器猫 · 用户对问题“使用dockerfile生成一个 ...· 2 年前 · |
|
|
高兴的显示器 · vba sub用法-掘金· 2 年前 · |
我正在尝试使用这个组件,我已经将它从2.1更新到3.1,我的导出现在被破坏了。这个新版本中不存在方法
create
,或者文档中遗漏了一些东西。
Excel::create()
Call to undefined method Maatwebsite\Excel\Excel::create()
发布于 2019-12-22 12:56:31
这里是文档 https://docs.laravel-excel.com/3.1/exports/
你必须在de文件夹中创建一个导出类:
应用程序/导出/
使用以下命令:
用户php artisan make:导出模型-- UsersExport =
将创建文件UsersExport.php
namespace App\Exports;
use App\User;
use Maatwebsite\Excel\Concerns\FromCollection;
class UsersExport implements FromCollection
public function collection()
return User::all();
}
在你的控制器中
namespace App\Http\Controllers;
use App\Exports\UsersExport;
use Maatwebsite\Excel\Facades\Excel;
class UsersController extends Controller
public function export()
return Excel::download(new UsersExport, 'users.xlsx');
}
在你的路线上
Route::get('users/export/', 'UsersController@export');
发布于 2020-07-30 17:49:43
使用laravel插件在excel中导出数据
Excel::create('filename',function($excel) use ($data){
$excel->sheet('filename', function($sheet) use ($data){
$sheet->fromArray($data, null, 'A1', false, false);
$sheet->cell('A1:Z1', function ($cells) {
$cells->setFontWeight('bold');
|
|
直爽的黄花菜 · Excel - Tableau 2 月前 |
|
|
坚强的馒头 · phpexcel 一些基本设置总结 - 声声慢43 4 周前 |
|
|
高兴的显示器 · vba sub用法-掘金 2 年前 |