简体   繁体   English

使用maatwebsite excel与用户冻结

[英]Using maatwebsite excel with userfrosting

I am trying to do an export of custom data which gets fed into DataTables in userfrosting. 我正在尝试导出自定义数据,该数据会在用户冻结时输入到DataTables中。 I have loaded the maatwebsite excel library using composer and the autoload_classmap.php was updated. 我已经使用composer加载了maatwebsite excel库,并且autoload_classmap.php已更新。 In the controller I tried using the following: 在控制器中,我尝试使用以下命令:

Excel::create('master',function($excel) use($events){                    
    $excel->sheet('Master List', function($sheet) use($events){          
        $sheet->fromArray($events);                                      
    });                                                                  
})->export('xls'); 

When I run this, I get the following error: 运行此命令时,出现以下错误:

PHP Fatal error:  Class 'UserFrosting\Excel' not found in /usr/www

I have looked at the laravel examples and tried them and they work with no problems. 我查看了laravel示例并进行了尝试,它们工作正常。 But I need this to work on userfrosting as the application is already and only missing the export. 但是我需要使用它来处理用户冻结,因为应用程序已经存在并且仅缺少导出。

This sounds like a namespace issue. 这听起来像一个名称空间问题。 Try: 尝试:

\Maatwebsite\Excel\Excel::create(...

Note that I've used the fully qualified namespace for the Excel class. 请注意,我已经为Excel类使用了完全限定的名称空间。

我最终离开maatwebsite/excel来使用phpoffice/phpexcel ,它对我来说工作更快一些,我将尝试在不久的将来得到这个问题的答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM