【发布时间】:2014-03-08 03:45:29
【问题描述】:
我想以 CSV 格式导出一组对象:
array(10) {
[0]=>
object(Produit)#228 (36) {
["id_produit":protected]=> string(4) "9999"
["reference":protected]=> string(9) "reference1"
}
[1]=>
object(Produit)#228 (36) {
["id_produit":protected]=> string(4) "8888"
["reference":protected]=> string(9) "reference2"
}
}
类似:
id_produit | reference | ...
9999 | reference1 | ...
8888 | reference2 | ...
第一行:属性/列列表
另一行:Object的属性值
带有对象的数组的真实示例: http://pastebin.com/8Eyf46pb
我试过这个:Convert array into csv 但它对我不起作用。
是否可以这样做(以及如何?)或者我必须在循环中编写每个属性?
【问题讨论】:
标签: php arrays object csv export