Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用phpexcel中的第一列名称获取值单元格_Php_Phpexcel - Fatal编程技术网

使用phpexcel中的第一列名称获取值单元格

使用phpexcel中的第一列名称获取值单元格,php,phpexcel,Php,Phpexcel,这是我在excel文件中的数据 如何使用第一列读取excel文件中的所有数据 这是我的控制器 $excelreader = new PHPExcel_Reader_Excel5(); $loadexcel = $excelreader->load('assets/excel/'.$name); $sheet = $loadexcel->getActiveSheet()->toArray(null, true, true ,true); 这是我的观点 <?php for

这是我在excel文件中的数据

如何使用第一列读取excel文件中的所有数据

这是我的控制器

$excelreader = new PHPExcel_Reader_Excel5();
$loadexcel = $excelreader->load('assets/excel/'.$name);
$sheet = $loadexcel->getActiveSheet()->toArray(null, true, true ,true);
这是我的观点

<?php foreach($sheet as $row) { ?>
<tr>
<td><?= $row['A'] ?></td>
<td><?= $row['B'] ?></td>
<td><?= $row['C'] ?></td>
<td><?= $row['D'] ?></td>
</tr>
<?php } ?>

欲望观

<?php foreach($sheet as $row) { ?>
<tr>
<td><?= $row['NO'] ?></td>
<td><?= $row['Name'] ?></td>
<td><?= $row['Address'] ?></td>
<td><?= $row['Phone Number'] ?></td>
</tr>
<?php } ?>

我想你不能那样做。 但如果列具有相同的名称,则可以执行此操作。
有必要在excel中重命名

我认为您不能这样做。 但如果列具有相同的名称,则可以执行此操作。
有必要在excel中重命名,因为它是一张工作表,所以您总是使用a、B、C、D。。。但您可以使用常量或类似的东西来做一些类似于$row[ADDRESS]的简短回答,这不太可能。标题行就是,标题行。电子表格中的单元格按其列和行寻址。您在输出中使用列名时遇到问题吗?嗯,这是一张表,所以您总是使用a、B、C、D。。。但您可以使用常量或类似的东西来做一些类似于$row[ADDRESS]的简短回答,这不太可能。标题行就是,标题行。电子表格中的单元格按其列和行寻址。在输出中使用列名是否有问题?