我正在尝试导入 excel 文件,但它总是给我这个错误:
PHPExcel_Exception
Row 2 is out of range (2 - 1)
我正在使用 Laravel 4,这是我的代码:
public function postExcel()
{
$file = Input::file('file');
$destinationPath = public_path() .'/uploads/temp/';
$filename = str_replace(' ', '_', $file->getClientOriginalName());
$file->move($destinationPath, $filename);
$result = Excel::selectSheets('Sheet1')->load($destinationPath)->get();
echo "<pre>";
var_dump($result->toArray());
exit;
}
这是我的虚拟 excel 文件:
我试过用谷歌搜索,但对于其他人来说,它似乎只在工作表不止一张时才会发生,但在我的情况下并非如此。