# excel数据提取 **Repository Path**: leruge/tp-excel ## Basic Information - **Project Name**: excel数据提取 - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-08-14 - **Last Updated**: 2026-08-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 提取Exce数据 > 支持提取图片,函数式图片和浮动图片都支持 ## 安装 `composer require leruge/excel` ## 调用方法 1. 类调用 ```php $excelUrl = '/Volumes/1TB/storage/hsl/20260814/a.xlsx'; // 本地绝对路径 $headMap = [ // 表头对应的字段,空数组的时候提取的数据没有字段名 '货号' => 'symbol', '条码' => 'no', '商品名称' => 'goods_name', '图片' => 'img', ]; $imgPath = '/static/uploads/excel/'; // 提取图片的相对路径 $info = \leruge\Excel::getData($excelUrl, $headMap, $imgPath); // $info 的结果是如写格式 $info = [ 'headers' = ['货号', '条码', '商品名称'], 'data', = [ ['symbol' => '2026081401', 'no' => 'T081401', 'goods_name' => '富士苹果', 'img' => '/static/uploads/excel/20260814/6a7ee364d38c5.png'], ['symbol' => '2026081402', 'no' => 'T081402', 'goods_name' => '水晶葡萄', 'img' => '/static/uploads/excel/20260814/6a7ee364d5ca0.png'] ] ]; ``` 2. 助手函数调用 ```php $excelUrl = '/Volumes/1TB/storage/hsl/20260814/a.xlsx'; // 本地绝对路径 $headMap = [ // 表头对应的字段,空数组的时候提取的数据没有字段名 '货号' => 'symbol', '条码' => 'no', '商品名称' => 'goods_name', '图片' => 'img', ]; $imgPath = '/static/uploads/excel/'; // 提取图片的相对路径 $info = get_excel_data($excelUrl, $headMap, $imgPath); // $info 的结果是如写格式 $info = [ 'headers' = ['货号', '条码', '商品名称'], 'data', = [ ['symbol' => '2026081401', 'no' => 'T081401', 'goods_name' => '富士苹果', 'img' => '/static/uploads/excel/20260814/6a7ee364d38c5.png'], ['symbol' => '2026081402', 'no' => 'T081402', 'goods_name' => '水晶葡萄', 'img' => '/static/uploads/excel/20260814/6a7ee364d5ca0.png'] ] ]; ```