2011-01-28 64 views
1

我正在编写一个脚本来将产品导出到Google Base ......问题在于,当我使用下面的代码时in stock被输出为"in stock"而Google不认识它,只承认没有引号。我不知道如何在没有引用的情况下做到这一点。fputcsv把报价放在不应该的地方

     $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').'-products/'.$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); 
+0

有什么$ seperatorValue的值?如果在$ row数组中使用双引号而不是单引号,会发生什么? – 2011-01-28 16:48:35

回答

0

我认为这是更好,如果你编写自己的功能,而不是使用fputcsv()

东西在下面的代码行

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

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

fwrite($output, $line); 

fclose($output); 

希望这有助于

相关问题