开发者

fputcsv putting quotes where it shouldn't

I'm writing a script to export products to Google Base... the problem is that when I use the following code in stock gets outputted as "in stock" and Google doesn't recognize that, it only recognizes it without the quotes. I don't know of a way to do this without including quotes there.

                        $row = array(
                            'new',
                            $product->getSku().'-'.$vehicle->getId(),
                            'https://www.domain.com/vehicles/'.str_replace(' ', '-', $make->getName()).'/'.str_replace(' ', '-', $model->getName()).'/'.$year.'/'.$product->getId(),
                            $this->tru->config->get('root.cdn.url').'-produc开发者_如何学编程ts/'.$product->getPicture(),
                            $product->getSellPrice(),
                            $title,
                            $year,
                            'in stock',
                            $product->getFCCID(),
                            'Visa,Mastercard,Discover,AmericanExpress',
                            'US::Ground:4.95,CA::Ground:28.95',
                            'small',
                            'Vehicles & Parts > Automotive Locking Systems > Remote Keyless Systems'
                        );

                        fputcsv($output, $row, $seperatorValue);


I think it is better if you write your own function rather than using fputcsv()

Something in the following lines of code

$output = fopen("path/to/your/file.csv", "a+");

$line = join(',', $row);

fwrite($output, $line);

fclose($output);

Hope this helps

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜