fgetcsv未正确分割数据 [英] fgetcsv is not splition data properly

查看:383
本文介绍了fgetcsv未正确分割数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在导入csv文件以将数据上传到数据库中.但是在某些产品中,说明无法正确进行. 描述就像

i am importing csv file to upload data into database. But in some products the description is not going through properly. the description is like

TSD/UHC UG-132型,带有塑料外壳的6英寸左轮手枪.外壳: 马克杯131 MUG131黄铜. 290-320 FPS和.20g BBS.

法律 免责声明

TSD/UHC Model UG-132, 6\" gas revolver with plastic shells. Shells: MUG131 & MUG131BRASS. 290-320 FPS with .20g BBS.

Legal Disclaimer

警告:该产品可能被误认为是 执法人员或其他人使用枪支并改变其颜色 或在公共场合挥舞该产品可能被视为犯罪.

Warning: This product may be mistaken for a firearm by law enforcement officers or others, and altering its color or brandishing the product in public may be considered a crime.

但是当我打印fgetcsv数组时,它以不同的数组形式显示此描述.

but when i print fgetcsv array it display this description in different array like.

[2] => TSD/UHC型号UG-132,带有塑料壳的6英寸左轮手枪. 弹药:MUG131& MUG131黄铜. 290-320 FPS和.20g BBS.合法的 免责声明

[2] => TSD/UHC Model UG-132, 6\" gas revolver with plastic shells. Shells: MUG131 & MUG131BRASS. 290-320 FPS with .20g BBS. Legal Disclaimer

限制:您必须年满18岁才能订购此产品.在一些 [3] =>地区和当地法律进一步限制或禁止 销售和拥有此产品.订购此产品[4] => 您证明自己已年满18岁并满足您的要求 管辖区对购买此产品的法律要求.
警告:该产品可能被执法部门误认为是枪支 军官或其他人[5] =>并更改其颜色或挥舞 在公共场合使用该产品可能被视为犯罪.

Restrictions: You must be 18 or older to order this product. In some areas [3] => state and local laws further restrict or prohibit the sale and possession of this product. In ordering this product [4] => you certify that you are at least 18 years old and satisfy your jurisdiction\'s legal requirements to purchase this product.
Warning: This product may be mistaken for a firearm by law enforcement officers or others [5] => and altering its color or brandishing the product in public may be considered a crime.

"

我也有更多带有反斜杠,单引号和双引号的描述的产品.某些其他产品已正确上传,但有些出现问题.

I also have more products with this kind of description with backslash, single quot and double quot. some other products are uploaded properly but some are having problem.

谢谢

推荐答案

fgetcsv($handle, 0, ",", '"', '""');

这篇关于fgetcsv未正确分割数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆