这是我的代码。我真的想从我的CSV文件中回显一个特定的单元格而没有任何MySQL的东西..
if (($handle = fopen("ebbe.csv", "r")) !== FALSE) {
# Set the parent multidimensional array key to 0.
$nn = 0;
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
# Count the total keys in the row.
$c = count($data);
# Populate the multidimensional array.
for ($x=0;$x<$c;$x++)
{
$csvarray[$nn][$x] = $data[$x];
//echo $data[$x] . '<br>';
}
$nn++;
}
fclose($handle);
}
数据位于$ csvarray多维数组中,但我无法写出特定数据。 我尝试过这个,但它说2上的未定义偏移量。
echo $csvarray[1][2];
请帮帮我! (是的,我是一个php noob :()
答案 0 :(得分:0)
尝试
echo '<pre>';
print_r($csvarray);
echo '</pre>';
它将显示数组的内容。既然您已经对阵列进行了直观呈现,那么您应该能够看到需要更深入的内容。