假设$this来自不兼容的上下文,则不应静态调用非静态方法Maatwebsite\Excel\Readers\La



每当我试图上传和excel文件时,都会收到这个错误

我的功能是

使用Illuminate\Support \ Facades\Input
使用Excel;

功能:-

公共函数importProduct(({
$file=Input::file('file'(;
$文件名=$file->getClientOriginalName
返回json_encode($result(
}

$result = Excel::load('excelData/'.$file_name, function(LaravelExcelReader $reader){
$reader::all();
})->get();

我认为这应该工作,如果你使用2.1版本的Excel

两步

1.首先获取路径

$path = $request->file('file')->getRealPath();

2.获取阵列中的数据

$data = Excel::load($path)->get();

现在我们可以玩数据阵列

最新更新