註冊服務提供者,在bootstrap/app.php文件下加入php
|-------------------------------------------------------------------------- | Register Service Providers |-------------------------------------------------------------------------- | | Here we will register all of the application's service providers which | are used to bind services into the container. Service providers are | totally optional, so you are not required to uncomment this line. | */ $app->register(Maatwebsite\Excel\ExcelServiceProvider::class); //註冊Excel服務提供者
添加類別名,在bootstrap/app.php文件下加入web
/* |-------------------------------------------------------------------------- | Class Aliases |-------------------------------------------------------------------------- | | This array of class aliases will be registered when this application | is started. However, feel free to register as many as you wish as | the aliases are "lazy" loaded so they don't hinder performance. | */ class_alias('Maatwebsite\Excel\Facades\Excel', 'Excel'); //添加Excel類別名