The exported database table from a cloud is in CSV format. It is found that double quotation marks are added to both sides of the bigint field. Why not remove them? Example record: {code...} the exported database table from a cloud is in CSV format. It is found that double quotation marks are added to both sides of the bigint field. Why not? How to remove it?
Example record:
"31189","aaaa","$P$BFMnptFob/7bmU2o***PNqorSMKzLs0","aaaa","aaa@qq.com","","2015-02-27 02:18:54","","0","oo","0000-00-00""31191","bbbb","$P$BeRmQEYPfnOfKrKpF***9osOe3v0aq/","bbb","bbb@qq.com","","2015-02-27 04:23:52","","0","bbb","0000-00-00"
Reply content:
The exported database table from a cloud is in CSV format. It is found that double quotation marks are added to both sides of the bigint field. Why not remove them?
Example record:
"31189","aaaa","$P$BFMnptFob/7bmU2o***PNqorSMKzLs0","aaaa","aaa@qq.com","","2015-02-27 02:18:54","","0","oo","0000-00-00""31191","bbbb","$P$BeRmQEYPfnOfKrKpF***9osOe3v0aq/","bbb","bbb@qq.com","","2015-02-27 04:23:52","","0","bbb","0000-00-00"
Why is there a corresponding function in php removed?
Http://php.net/str_getcsv
A php version has been processed.
Function fucking_aliyun_rds ($ line ){
if(!$line) return; $line=(string)$line; $pattern='/^\"\d{1,5}\"/'; $int=$replacement=false; if(preg_match($pattern, $line, $matches)){ $int=(int)str_replace('"', '', $matches[0]); }else{ return $line; } if($int){ $replacement = $int; $line=preg_replace('""', '',$line); $b=preg_replace($pattern, $replacement, $line); } $b.="\t"; return $b;
}
$ F = fopen ("wp_users.txt", "r ");
$ Ln = 0;
While (! Feof ($ f )){
$ Line = fgets ($ f );
/* ++ $ Ln;/
/Printf ($ ln );*/
If ($ line = FALSE ){
}
Else {
$a=fucking_aliyun_rds($line); echo $a;}
}
Fclose ($ f );