如何将结果数组转换为CSV文件。
假设我搜索某些东西,我得到的结果是这样的 -
Array
(
[1] => Array
(
[id] => 11
[category] => phone cases
[sale_price] => 90,99
[price] => 120
[product_name] => "iphone 6 plus" case transparent
)
[2] => Array
(
[id] => 13
[category] => shoes
[sale_price] => 180,99
[price] => 200
[product_name] => blue platform shoes
)
[3] => Array
(
[id] => 14
[category] => wallet
[sale_price] => 150
[price] => 250
[product_name] => velvet wallet
我试过这样---
$csvFile = fopen('/path/to/csvFile.csv', 'w+');
fputcsv($csvFile, $array);
但总是得到错误 -
注意:数组到字符串转换(500内部服务器错误)
现在我如何将此结果转换为CSV文件! 任何人都知道这个问题的任何简单解决方案!