我得到了这个变量:
$payments['date'] = 21062013
问题:
它是一个日期,所以我想在这个字符串中添加斜杠。
我是如何尝试的:
echo $paymentdate = substr($payments['date'],2)+/+substr($payments['date'],4)+/substr($payments['date'],8);
打不开,有大神帮忙吗?
我的完整代码:
$i = 0;
foreach($SQL->query('SELECT id, form, email, value, data, date, compensated from payments where compensated="N"') as $payments)
{
$i++;
$paymentdate = substr($payments['date'], 0, 2)."/".substr($payments['date'], 2, 2)."/".substr($payments['date'], 2, 8);
echo '<tr bgcolor="' . (is_int($i / 2) ? $config['site']['darkborder'] : $config['site']['lightborder']) . '">
<td>' . $payments['id'] . '</td>
<td>' . $payments['form'] . '</td>
<td>' . $payments['email'] . '</td>
<td>' . $payments['value'] . '</td>
<td>' . $paymentdate .'</td>
<td>' . $payments['data'] . '</td>
<td>' . $payments['compensated'] . '</td>
<td>a</td>
</tr>';
}