2016-07-27 32 views
-1

我不明白什麼是錯的這陣,爲什麼它不工作,當任何其他時候它的工作...PHP插入值錯誤

它的簡單,我做一個foreach循環和值插入到一個數組:

$insert = []; 

foreach ($csv as $i=>$row) { 

    $insert[$i] = [ 
     'id_customer' => $row[0], 
     'id_shop_group' => $row[1], 
     `id_shop` => $row[2], 
    ]; 
} 

的陣列產生的是:

0 => 
    array (size=3) 
     'id_customer' => string '14' (length=2) 
     'id_shop_group' => string '1' (length=1) 
     '' => string '1' (length=1) 

我不明白......我創造我自己的鑰匙,它應該被添加到陣列中,但它不是......是什麼問題?

+2

您對'id_shop'使用'''',而不是像'id_customer'和'id_shop_group'那樣使用''''。 – Albzi

回答

1

你的錯誤在於使用了錯誤的'。在你使用的第三個數組鍵中,而不是'

+0

fck我的生活....謝謝! – Dominykas55