我試圖讓這個代碼工作,因爲它正是我追求: http://www.reloadedpc.com/php/php-convert-csv-price-matrix-mysql-table/CSV矩陣到MySQL
雖然我得到這個錯誤:
Warning: array_merge() [function.array-merge]: Argument #1 is not an array in C:\xampp\htdocs\matrix\Csv.php on line 580
Warning: array_merge() [function.array-merge]: Argument #1 is not an array in C:\xampp\htdocs\matrix\Csv.php on line 580
Warning: array_merge() [function.array-merge]: Argument #1 is not an array in C:\xampp\htdocs\matrix\Csv.php on line 580
Fatal error: Cannot access protected property Csv::$field_names in C:\xampp\htdocs\matrix\index.php on line 24
580線是以下Csv.php是:
$this->contents[$line_nr][(int) $position] = array_merge($this->contents[$line_nr][(int) $position]);
的index.php的
和線24(和23)是:
//get the row of width increments
$stack = $csv->field_names;
的Csv.php文件可以在這裏看到: http://hg.mijnpraktijk.com/csv-library/src/e4397b31002d/Csv.php
有什麼建議?
謝謝你們。
CNC中 整個代碼塊是:
foreach ($this->contents as $line_nr => $line)
{
if (array_key_exists((int) $position, $this->contents[$line_nr]))
{
$return[$line_nr] = $this->contents[$line_nr][(int) $position];
unset($this->contents[$line_nr][(int) $position]);
// reindex after removal
$this->contents[$line_nr][(int) $position] = array_merge($this->contents[$line_nr][(int) $position]);
}
}
它似乎取消它。 $ this-> contents [$ line_nr] [(int)$ position]是矩陣的標題。
你做任何調試,看看有什麼'$這個 - >內容[$ line_nr] [(INT)$位置]'實際上是? – 2012-08-08 08:59:44
添加在原始帖子中 – user1380591 2012-08-08 09:07:57