我在网上找到了几个关于强制包含 fputcsv 输出的主题,发现这是不可能的。由于某些导入要求,我需要用引号将每个输出括起来。单独的单词有效,但非单独的作品无效。我看到有几个解决方法,但我无法让它们工作。例如,我有这个代码:
/** * Writes the row(s) for the given order in the csv file. * A row is added to the csv file for each ordered item. * * @param Mage_Sales_Model_Order $order The order to write csv of * @param $fp The file handle of the csv file */ protected function writeOrder($order, $fp) { $common = $this->getCommonOrderValues($order); $orderItems = $order->getItemsCollection(); $itemInc = 0; foreach ($orderItems as $item) { if (!$item->isDummy()) { $record = array_merge($common, $this->getOrderItemValues($item, $order, ++$itemInc)); fputcsv($fp, $record, self::DELIMITER, self::ENCLOSURE); } } }
你能帮我解决这个问题吗?