我正在尝试添加以下代码来回显php ECHO语句,但不确定如何。
要添加的代码(以指定格式显示日期)
<? echo date("F j, Y", $topic->created); ?>
应添加代码
<?php
$results = $page->children;
foreach($results as $topic) {
//Theme each topic
echo "
<div class='topic col-md-6'>
<a href='{$topic->url}'><h3 class='list-group-item-heading'>{$topic->title}</h3></a>
<strong>Started by:</strong> {$topic->createdUser->name}
<strong>@</strong> {$topic->created} //Where code should be added.
</div>
<div class='col-md text-right'>
{$topic->numChildren}
Comments
</div>
<div class='col-md text-right'>
20 Views
</div>
<hr>
";
}
?>
答案 0 :(得分:0)
试试这个:
<?php
$results = $page->children;
foreach($results as $topic) {
//Theme each topic
echo "
<div class='topic col-md-6'>
<a href='{$topic->url}'><h3 class='list-group-item-heading'>{$topic->title}</h3></a>
<strong>Started by:</strong> {$topic->createdUser->name}
<strong>@</strong> " . date("F j, Y", $topic->created) . " //Where code I added.
</div>
<div class='col-md text-right'>
{$topic->numChildren}
Comments
</div>
<div class='col-md text-right'>
20 Views
</div>
<hr>
";
}
&GT;