我试图从这个ExpressionEngine循环创建一个JSON输出。它正在输出正确的JSON格式,但我似乎无法删除','在最后一个条目。
想知道删除此内容的最简单方法吗?
谢谢!
<?php
class TmeTbl {
public $title = "";
public $image = "";
public $day = "";
public $start_time = "";
public $end_time = "";
public $timetable_studio = "";
public $timetable_description = "";
}
?>
{
"items": [
{exp:channel:entries channel="timetable" limit="1"}
{timetable}
<?php
$e = new TmeTbl();
$e->title = "{title}";
$e->image = "{image}";
$e->day = "{day}";
$e->start_time = "{start_time}";
$e->end_time = "{end_time}";
$e->timetable_studio = "{studio}";
$e->timetable_description = "{timetable_description}";
$json = json_encode($e).',';
echo $json;
?>
{/timetable}
{/exp:channel:entries}
]
}