<?php
$result = $sth1->fetchAll(PDO::FETCH_ASSOC);
foreach($result as $row)
{
echo "<div class='listing'>";
print $row['uUName'] . '</strong><br />' .
'<strong>' . $row['listTitle'] . '</strong><br />' .
$arr = explode(':', $row['diff']);
echo "{$arr[0]} hours, {$arr[1]} minutes ago";
echo "</div>";
}
unset($sth1);
?>
对外输出
Array01 hours, 48 minutes ago
Array04 hours, 01 minutes ago
我如何获得RID: Array01 Array04 从一开始就只剩下:
01 hours, 48 minutes ago
04 hours, 01 minutes ago
答案 0 :(得分:2)
<?php
$result = $sth1->fetchAll(PDO::FETCH_ASSOC);
foreach($result as $row)
{
echo "<div class='listing'>";
print $row['uUName'] . '</strong><br />' .
'<strong>' . $row['listTitle'] . '</strong><br />';
$arr = explode(':', $row['diff']);
echo "{$arr[0]} hours, {$arr[1]} minutes ago";
echo "</div>";
}
unset($sth1);
?>
注意第8行,我删除了你的'。并用';到底。