如何从 php 多维数组中排除键?

How to exclude keys from a php multidimensional array?

我有一个代码可以让我像这样读取 csv 文件:

REFERENCE;COLOR;QUANTITY;TURNOVER;SELL TROUGH;COMMENT
GJK0C9;8952;3;90;3%;Pack S
GJKCS4;399;2;19;10%;Windows

这样我就可以浏览它并在这样的页面上显示 csv 信息:

但我希望前两列 "REFERENCE" 和 "COLOR" 只出现在每张图片的顶部,而不是与输入一起出现。

如何将它们从我的阵列显示中排除?

<?php

$column = []; //create an array

        if (($handle = fopen("$nomcsv", "r")) !== FALSE) { 

                        // Get headers
                if (($data = fgetcsv($handle, 1000, ';')) !== FALSE)
                {
                    $column = $data; // assign header value to array
                }

                 // Get the rest
            while(($data = fgetcsv($handle, 1000000, ";")) !== FALSE) {

                    $file = '//Alcyons/it/PhotoShoot/Photos_Outil/'.$data[0].'_'.str_pad(trim($data[1]),4, "0", STR_PAD_LEFT).'-1.jpg';
                    $type = pathinfo($file, PATHINFO_EXTENSION);

                    echo "<tr><td valign=top><strong>".$data[0]."</strong><br><font color=\"#666666\">Color:</font>".$data[1]."
                    <div style=\"font-size:10px;\"><br>RRP:
                    <br><input type=text value=\"".$rrp."\" style=\"width:100px\">";

                    $row = array_combine($column,$data); // combine header with values
                    foreach($row as $key=>$value){

                        array_splice($key, 1, 1); //I tried this but doesn't work
                        echo "<br>$key:<br><input type=text value=\"".$value."\" style=\"width:100px\">";
                    } 

                    echo "</td><td valign=top align=center>";?><img src="<?php echo "data:image/$type;base64,",base64_encode(file_get_contents($file))?>""
                    <?php
                    echo "border=0 width=180></a></td><td width=10></td>";

                  }     

                }

?>

您需要应用 if 来检查密钥并跳过打印这 2 个密钥(REFERENCECOLOR):

foreach($row as $key=>$value){

  if($key !=='REFERENCE' && $key !== 'COLOR'){
    echo "<br>$key:<br><input type=text value=\"".$value."\" style=\"width:100px\">";
  }
}