【发布时间】:2013-05-28 09:50:38
【问题描述】:
我好像又被卡住了! - 我在星期五问了这个问题,@Bartdude 回答得很好 - Array output and date format
这输出了一个这样的数组 -
[0]=> object(stdClass)#270 (3)
{
["Month(StartDate)"]=> string(1) "4"
["Year(StartDate)"]=> string(4) "2013"
["nrOfEvents"]=> string(2) "12"
}
[1]=> object(stdClass)#176 (3)
{
["Month(StartDate)"]=> string(1) "5"
["Year(StartDate)"]=> string(4) "2013"
["nrOfEvents"]=> string(2) "19"
}
[2]=> object(stdClass)#114 (3)
{
["Month(StartDate)"]=> string(1) "6"
["Year(StartDate)"]=> string(4) "2013"
["nrOfEvents"]=> string(2) "12"
}
}
然后在通过 Stack Exchange 进行一些搜索后,我发现这将返回 nrofEvents -
echo $results[0]->nrOfEvents
// Outputs - 12
我很难理解如何在 foreach 循环中访问数组中的 ["Month(StartDate)"]。
我的最终目标是实现一个包含月份名称的月份表,例如
| 三月 (12) | 四月(19) | 六月(12) |
| 七月(3) | 8 月(4) | 九月(5) |
任何帮助我理解的帮助都会很棒,并提前感谢。
【问题讨论】: