fputcsv 将引号放在不应该的地方
我正在编写一个脚本将产品导出到 Google Base...问题是,当我使用以下代码时,in stock
会输出为 "in stock"
和 Google不识别它,它只识别不带引号的它。我不知道有什么方法可以在不包含引号的情况下做到这一点。
$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);
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').'-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);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为最好是编写自己的函数而不是使用 fputcsv()
以下代码行中的内容
希望这会有所帮助
I think it is better if you write your own function rather than using fputcsv()
Something in the following lines of code
Hope this helps