【发布时间】:2016-07-11 09:26:50
【问题描述】:
我正在创建一个这样的 Xml:
private function setTitle()
{
$rC = $this->data->rC;
$cTimes = array();
$i = 0;
foreach ($rC as $rCKey => $rCValue)
{
$cTimes[] = $rCValue->input_c_start;
}
foreach ($rC as $rCKey => $rCValue)
{
$this->title = $this->titleSetTitles->addChild('title');
$this->title->addAttribute('chapters', $cTimes[$i]);
$i++;
}
}
输出是这样的:
<title chapters="00:01">
...
</title>
<title chapters="00:02">
...
</title>
我现在的问题是如何在每个循环中添加章节时间,使其看起来像这样:
<title chapters="00:01">
...
</title>
<title chapters="00:01; 00:02">
...
</title>
<title chapters="00:01; 00:02; 00:03">
...
</title>
【问题讨论】: