我有一组类在星期一,他们在5个不同的房间。我想提出他们在列的基础上使用div和排序的位置,开始。我得到的数据没有问题(找到所有类,运行在星期一),但它只是列出它在一列,所以我的foreach数组是不正确的。这里的$data
$calendar = array();
foreach ($data as $row) {
$calendar[$row[0]][] = $row;
}
foreach($calendar as $key => $row) {
foreach($row as $field => $value) {
$recNew[$field][] = $value;
}
}
字符串
下面是数组expert
array(1) {
[""]=> array(20)
{
[0]=> array(1) {
["calendars"]=> array(9) {
["id"]=> string(3) "742"
["title"]=> string(4) "Yoga"
["start_date"]=> string(10) "2015-09-14"
["end_date"]=> string(10) "0000-00-00"
["start_time"]=> string(8) "20:00:00"
["end_time"]=> string(8) "21:00:00"
["location"]=> string(8) "Studio 1"
["calendar_category_id"]=> string(1) "3"
["recur_mon"]=> string(1) "1"
}
}
[1]=> array(1) {
["calendars"]=> array(9) {
["id"]=> string(3) "743"
["title"]=> string(2) "GX"
["start_date"]=> string(10) "2015-09-14"
["end_date"]=> string(10) "0000-00-00"
["start_time"]=> string(8) "18:00:00"
["end_time"]=> string(8) "18:45:00"
["location"]=> string(8) "Studio 1"
["calendar_category_id"]=> string(1) "3"
["recur_mon"]=> string(1) "1"
} }
[2]=> array(1) {
["calendars"]=> array(9) {
["id"]=> string(3) "447"
["title"]=> string(4) "Spin"
["start_date"]=> string(10) "2015-09-14"
["end_date"]=> string(10) "0000-00-00"
["start_time"]=> string(8) "09:15:00"
["end_time"]=> string(8) "10:00:00"
["location"]=> string(8) "Studio 1"
["calendar_category_id"]=> string(1) "3"
["recur_mon"]=> string(1) "1"
} }
[3]=> array(1) {
["calendars"]=> array(22) {
["id"]=> string(3) "448"
["title"]=> string(4) "Spin"
["start_date"]=> string(10) "2015-09-14"
["end_date"]=> string(10) "0000-00-00"
["start_time"]=> string(8) "12:15:00"
["end_time"]=> string(8) "13:00:00"
["location"]=> string(8) "Studio 1"
["calendar_category_id"]=> string(1) "3"
["recur_mon"]=> string(1) "1" } }
[4]=> array(1) {
["calendars"]=> array(22) {
["id"]=> string(3) "684"
["title"]=> string(4) "Spin"
["start_date"]=> string(10) "2015-09-14"
["end_date"]=> string(10) "0000-00-00"
["start_time"]=> string(8) "16:30:00"
["end_time"]=> string(8) "17:15:00"
["location"]=> string(8) "Studio 1"
["calendar_category_id"]=> string(1) "3"
["recur_mon"]=> string(1) "1"
} }
[5]=> array(1) {
["calendars"]=> array(22) {
["id"]=> string(3) "545"
["title"]=> string(4) "Yoga"
["start_date"]=> string(10) "2015-09-14"
["end_date"]=> string(10) "0000-00-00"
["start_time"]=> string(8) "18:15:00"
["end_time"]=> string(8) "19:00:00"
["location"]=> string(8) "Studio 1"
["calendar_category_id"]=> string(1) "3"
["recur_mon"]=> string(1) "1"
} }
[6]=> array(1) { ["calendars"]=> array(9) {
["id"]=> string(3) "549"
["title"]=> string(4) "Yoga"
["start_date"]=> string(10) "2015-09-14"
["end_date"]=> string(10) "0000-00-00"
["start_time"]=> string(8) "09:00:00"
["end_time"]=> string(8) "10:00:00"
["location"]=> string(8) "Studio 2"
["calendar_category_id"]=> string(1) "3"
["recur_mon"]=> string(1) "1" } }
[7]=> array(1) { ["calendars"]=> array(9) {
["id"]=> string(3) "688"
["title"]=> string(7) "Weights"
["start_date"]=> string(10) "2015-09-14"
["end_date"]=> string(10) "0000-00-00"
["start_time"]=> string(8) "10:10:00"
["end_time"]=> string(8) "11:00:00"
["location"]=> string(8) "Studio 2"
["calendar_category_id"]=> string(1) "3"
["recur_mon"]=> string(1) "1"
} }
[8]=> array(1) { ["calendars"]=> array(9) {
["id"]=> string(3) "572"
["title"]=> string(4) "Yoga"
["start_date"]=> string(10) "2015-09-14"
["end_date"]=> string(10) "0000-00-00"
["start_time"]=> string(8) "12:10:00"
["end_time"]=> string(8) "13:10:00"
["location"]=> string(8) "Studio 2"
["calendar_category_id"]=> string(1) "3"
["recur_mon"]=> string(1) "1"
} }
[9]=> array(1) { ["calendars"]=> array(9) {
["id"]=> string(3) "548"
["title"]=> string(4) "Spin"
["start_date"]=> string(10) "2015-09-14"
["end_date"]=> string(10) "0000-00-00"
["start_time"]=> string(8) "16:00:00"
["end_time"]=> string(8) "16:55:00"
["location"]=> string(8) "Studio 2"
["calendar_category_id"]=> string(1) "3"
["recur_mon"]=> string(1) "1"
} }
[10]=> array(1) { ["calendars"]=> array(9) {
["id"]=> string(3) "573"
["title"]=> string(11) "Power Yoga"
["start_date"]=> string(10) "2015-09-14"
["end_date"]=> string(10) "0000-00-00"
["start_time"]=> string(8) "18:45:00"
["end_time"]=> string(8) "19:45:00"
["location"]=> string(8) "Studio 2"
["calendar_category_id"]=> string(1) "3"
["recur_mon"]=> string(1) "1"
} }
[11]=> array(1) { ["calendars"]=> array(9) {
["id"]=> string(3) "742"
["title"]=> string(4) "Yoga"
["start_date"]=> string(10) "2015-09-14"
["end_date"]=> string(10) "0000-00-00"
["start_time"]=> string(8) "20:00:00"
["end_time"]=> string(8) "21:00:00"
["location"]=> string(8) "Studio 2"
["calendar_category_id"]=> string(1) "3"
["recur_mon"]=> string(1) "1"
} }
[12]=> array(1) { ["calendars"]=> array(9) {
["id"]=> string(3) "552"
["title"]=> string(5) "Zumba"
["start_date"]=> string(10) "2015-09-14"
["end_date"]=> string(10) "0000-00-00"
["start_time"]=> string(8) "10:15:00"
["end_time"]=> string(8) "11:15:00"
["location"]=> string(8) "Studio 3"
["calendar_category_id"]=> string(1) "3"
["recur_mon"]=> string(1) "1"
} }
[13]=> array(1) { ["calendars"]=> array(9) {
["id"]=> string(3) "622"
["title"]=> string(4) "Yoga"
["start_date"]=> string(10) "2015-09-14"
["end_date"]=> string(10) "0000-00-00"
["start_time"]=> string(8) "11:30:00"
["end_time"]=> string(8) "12:00:00"
["location"]=> string(8) "Studio 3"
["calendar_category_id"]=> string(1) "3"
["recur_mon"]=> string(1) "1"
} }
[14]=> array(1) { ["calendars"]=> array(9) {
["id"]=> string(3) "570"
["title"]=> string(22) "Body Pump (Doriana P.)"
["start_date"]=> string(10) "2015-09-14"
["end_date"]=> string(10) "0000-00-00"
["start_time"]=> string(8) "12:15:00"
["end_time"]=> string(8) "13:15:00"
["location"]=> string(8) "Studio 3"
["calendar_category_id"]=> string(1) "3"
["recur_mon"]=> string(1) "1"
} }
[15]=> array(1) { ["calendars"]=> array(9) {
["id"]=> string(3) "740"
["title"]=> string(4) "Spin"
["start_date"]=> string(10) "2015-09-14"
["end_date"]=> string(10) "0000-00-00"
["start_time"]=> string(8) "13:30:00"
["end_time"]=> string(8) "14:00:00"
["location"]=> string(8) "Studio 4"
["calendar_category_id"]=> string(1) "3"
["recur_mon"]=> string(1) "1
} }
[16]=> array(1) { ["calendars"]=> array(9) {
["id"]=> string(3) "623"
["title"]=> string(7) "Weights"
["start_date"]=> string(10) "2015-09-14"
["end_date"]=> string(10) "0000-00-00"
["start_time"]=> string(8) "16:45:00"
["end_time"]=> string(8) "17:45:00"
["location"]=> string(8) "Studio 4"
["calendar_category_id"]=> string(1) "3"
["recur_mon"]=> string(1) "1"
} }
[17]=> array(1) { ["calendars"]=> array(9) {
["id"]=> string(3) "586"
["title"]=> string(2) "GX"
["start_date"]=> string(10) "2015-09-14"
["end_date"]=> string(10) "0000-00-00"
["start_time"]=> string(8) "18:00:00"
["end_time"]=> string(8) "18:30:00"
["location"]=> string(8) "Studio 5"
["calendar_category_id"]=> string(1) "3"
["recur_mon"]=> string(1) "1"
} }
[18]=> array(1) { ["calendars"]=> array(9) {
["id"]=> string(3) "613"
["title"]=> string(7) "Weights"
["start_date"]=> string(10) "2015-09-14"
["end_date"]=> string(10) "0000-00-00"
["start_time"]=> string(8) "18:45:00"
["end_time"]=> string(8) "19:30:00"
["location"]=> string(8) "Studio 5"
["calendar_category_id"]=> string(1) "3"
["recur_mon"]=> string(1) "1"
} }
[19]=> array(1) { ["calendars"]=> array(9) {
["id"]=> string(3) "621"
["title"]=> string(5) "Zumba"
["start_date"]=> string(10) "2015-09-14"
["end_date"]=> string(10) "0000-00-00"
["start_time"]=> string(8) "19:45:00"
["end_time"]=> string(8) "20:45:00"
["location"]=> string(8) "Studio 5"
["calendar_category_id"]=> string(1) "3"
["recur_mon"]=> string(1) "1"
} }
}
型
x1c 0d1x的数据
<?php foreach ($recNew as $key => $classes) { ?>
<div class="locations-wrapper">
<div class="my-locations"><?php echo $location[$key]; ?></div>
<?php foreach ($classes as $class) : ?>
<!-- class info here -->
<div class="class">
<h4><?php echo $class['calendars']['title']; ?></h4>
</div><!-- end div class -->
<?php endforeach; ?>
</div>
<?php } ?>
型
这是我得到的
可能需要地点是关键。
1条答案
按热度按时间fcy6dtqo1#
您可以尝试使用html表格打印结果:
字符串