(ps看不懂我下面说讲述的可以参考这个laravel学院的官方文档 https://xueyuanjun.com/post/2024.html

  官方主页:https://laravel-excel.com/

1.1使用的时候先用composer安装excel依赖

这里需要注意一下最好只用laravel5.0的框架然后使用excel2.0不然的话会报错

第一个是默认安装一般安装最新版本,第二个是2.1版本

composer require maatwebsite/excel    composer require maatwebsite/excel ~2.1

1.2同样在aliases数组:

'Excel' => Maatwebsite\Excel\Facades\Excel::class,

1.3如果想要对Laravel Excel进行更多的自定义配置,执行如下Artisan命令:(ps:这个看情况选择你需要的配置)

php artisan vendor:publish

 上面的如果你不会执行的话就直接执行第二个

  php artisan vendor:publish --provider="Maatwebsite\Excel\ExcelServiceProvider"  

 

namespace App\Http\Controllers;
use App\Http\Controllers\Admin\ContentTypes\File;
use App\Models\Win1;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Storage;
use Maatwebsite\Excel\Facades\Excel;
use Illuminate\Routing\Controller;
use Symfony\Component\CssSelector\Parser\Reader;
使用的时候需要导入的use类

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2021-09-22
  • 2021-07-31
猜你喜欢
  • 2021-07-04
  • 2022-02-17
  • 2021-07-25
  • 2021-06-21
  • 2021-06-09
相关资源
相似解决方案