我有一个CSV文件,下面的代码用于将CSV内容放入多维数组中。从CSV中输出所有多维数组,数组数据 - PHP
<?php
$val = $_GET['articleid'];
//URL Pass STring
$arrCSV = array();
// Open the CSV
if (($handle = fopen("../articles/artlist.csv", "r")) !==FALSE) {
// Set the parent array key to 0
$key = 0;
// While there is data available loop through unlimited times (0) using separator (,)
while (($data = fgetcsv($handle, 0, ",")) !==FALSE) {
// Count the total keys in each row
$c = count($data);
//Populate the array
for ($x=0;$x<$c;$x++) {
$arrCSV[$key][$x] = $data[$x];
}
$key++;
} // end while
// Close the CSV file
fclose($handle);
} // end if
?>
我的第一部分是输出整个数组。
我觉得下面这段代码是错误的:(
<?php
for ($row = 1; $row <$arrCSV; $row++)
{
echo ''.$arrCSV[$row]['6'].'';
}
?>
然后我会把它想只列输出一个[*] [6]。
我想我应该到这里来的拳头之前我尝试休息。
任何指导,将帮助。
我努力学习,到目前为止,我还这么远了。
谢谢
确定。我需要这部分.. <?php \t \t print_r($ arrCSV); \t?> – Arthor
好的..我正在看... – Arthor
你好,请任何人都可以帮助代码。 – Arthor