0

我在phpmyadmin中有数据,例如:(第一行是标题)

||from||to||messages||

||john||andy||meeting now||

||dony||sherly||Place in \"Jakarta\" , Indonesia, 15412

当我通过 phpmyadmin 3.5.6 版导出到 csv 时,我得到了这个 csv 文件:

"from","to","messages"

"john","andy","meeting now"

"from","to","Place in \""Jakarta\"" , Indonesia, 15412"

如果我使用此代码

<?php
// code start 

$file = fopen($path, 'r');

while (($line = fgetcsv($file)) !== FALSE) {

print_r($line);

}

fclose($file);

// code end
?>

我希望得到这个

//output start

Array

(

[0] => from

[1] => to

[2] => messages

)

Array

(

[0] => john

[1] => andy

[2] => meeting now

)

Array

(

[0] => dony

[1] => sherly

[2] => Place in \"Jakarta\" , Indonesia, 15412

)

//output end

但相反我得到

//output start

Array

(

[0] => from

[1] => to

[2] => messages

)

Array

(

[0] => john

[1] => andy

[2] => meeting now

)

Array

(

[0] => from

[1] => to

[2] => Place in \"Jakarta\"" 

[3] =>  Indonesia

[4] =>  15412"

)

//output end

任何人都可以帮助这个错误?

4

1 回答 1

0

你有双双引号。

"from","to","Place in \""Jakarta\"" , Indonesia, 15412"

应该

"from","to","Place in \"Jakarta\" , Indonesia, 15412"
于 2013-04-10T11:18:01.283 回答