我有以下这样的csv数值:
$csv_data = "test,this,thing
hi,there,this
is,cool,dude
have,fun";
我想将整个CSV字符串读入到一个多维数组中,以便我得到:array(
array(
'test' => 'hi',
'this' => 'there',
'thing' => 'this'
),
array(
'test' => 'is',
'this' => 'cool',
'thing' => 'dude'
),
array(
'test' => 'have',
'this' => 'fun',
'thing' => ''
)
);
我希望得到这样的输出,注意CSV的值是动态的。
have,fun
,只有两列,不像其他行那样有三列。我们需要考虑处理列数不正确的行吗? - Wiseguy