php写csv没有换行 [英] php writing csv not getting line break

查看:91
本文介绍了php写csv没有换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个带有新行的csv输出,以便从每组数据开始。
i获取文件,但没有换行符
我的输出页

  $ values = mysqli_query($ dbc,SELECT specials.specials_id,specials.products_id,specials_new_products_price,products.products_image,products.products_price,products .products_image,products.products_quantity,products.products_model,products_description.products_name,products_description.products_description 
从特价
JOIN products_description
JOIN产品
WHERE specials.products_id = products.products_id AND specials .products_id = products_description.products_id AND products.products_quantity> 0);
while($ rowr = mysqli_fetch_row($ values)){
for($ j = 0; $ j< $ numberOfRows; $ j ++){
$ csv_output。= $ rowr [$ j ]。
}
$ csv_output。=\\\
;
}

}

print $ csv_output;
exit;
?>


解决方案

\\\



请尝试< br> / p>

i want to create a csv output with a new line to start with each set of data. i get the file but there is no line break my output page

$values = mysqli_query($dbc, "SELECT specials.specials_id, specials.products_id,specials_new_products_price, products.products_image,  products.products_price,products.products_image, products.products_quantity,products.products_model,products_description.products_name,products_description.products_description
FROM specials
JOIN products_description
JOIN products
WHERE specials.products_id = products.products_id AND specials.products_id = products_description.products_id AND products.products_quantity>0");
while ($rowr = mysqli_fetch_row($values)) {
 for ($j=0;$j<$numberOfRows;$j++) {
  $csv_output .= $rowr[$j].", ";
 }
 $csv_output .= "\n";
}

}

print $csv_output;
exit;
?>

解决方案

The "\n" is a linebreak, indeed. But they don't show up in the browser.

Try <br> instead

这篇关于php写csv没有换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆