我正在尝试创建一个动态 csv 文件以导出到我网站上的供应商网站。他们希望所有值都用双引号括起来。我正在尝试创建该行,然后将其提供给 fputcsv() 但是当我在 notepad2 中查看它时它会出现大量双引号,而在 Excel 中查看它时它会作为 1 个条目出现。这是我的价值观:
$line = '"'.$row->petID.'","'.$row->customID.'","'.$row->petName.'","'.trim($row->breedName1).'","'.trim($row->breedName2).'","'.$df->setGender($row->gender).'","'.$df->setSize($row->size).'","'.$df->setAge($row->age).'","'.$description.'","'.$row->pType.'","'.$df->setStatus($row->status).'","","'.$row->isAltered.'","'.$ND.'","'.$NC.'","'.$NK.'","'.$df->isHousetrained($row->housebroken).'","'.$df->isDeclawed($row->declaw).'","'.$df->isSpecialNeeds($row->isSpecial).'","'.$df->isMix($row->breed2).'","'.$PhotoURL1.'","'.$PhotoURL2.'","'.$PhotoURL3.'"';
使用文本编辑器输出如下:"""13651"","""",""jack"",""Chihuahua"",""Pomeranian"",""M"",""S "",""Baby"",""Jack 和 Jose 出生于一只可爱的 7 磅吉娃娃/博美犬混血儿,他们作为流浪狗被带到收容所。他们将在 8 月中旬为新家断奶。尽管父亲不详, 幼犬很可能仍然很小。请访问我们的网站 www.dogswithoutborders.org 以获取 Jack 或 Jose 的在线收养申请,并了解有关我们收养博览会的更多信息。"",""Dog"",""A" ","""",""0"","""","""","""","""","""","""",""1"","" http://photos.petfinder.com/photos/US/CA/CA1087/20460152/CA1087。 20460152-1-x.jpg "","""","""""
当我删除手动添加的“(s)”时,我一开始只得到一个,最后一个。有什么想法吗?