本文整理汇总了PHP中DataAccess::get_highscores方法的典型用法代码示例。如果您正苦于以下问题:PHP DataAccess::get_highscores方法的具体用法?PHP DataAccess::get_highscores怎么用?PHP DataAccess::get_highscores使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataAccess
的用法示例。
在下文中一共展示了DataAccess::get_highscores方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: currentView
<div class="page-container" data-bind="if: currentView() === 'high-scores'">
<div class="well">
<h2>High Scores</h2>
<table class="table table-border">
<thead>
<tr>
<th></th>
<th>Level</th>
<th>Score</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<?php
$data_access = new DataAccess();
$highscores_array = $data_access->get_highscores();
foreach ($highscores_array as $row) {
$date = date_create($row['end']);
$dateScore = date_format($date, 'l, F jS, Y \\a\\t g:ia');
echo '<tr>';
echo '<td><img src="pics/Robot_Character1_Blue.png" height="60"/></td>';
echo '<td>' . $row['level_id'] . '</td>';
echo '<td>' . $row['highscore'] . '</td>';
echo '<td>' . $dateScore . '</td>';
echo '</tr>';
}
?>
</tbody>
</table>
</div>
</div>
示例2: json_encode
<?php
if ($_SERVER["REQUEST_METHOD"] !== 'GET') {
http_response_code(405);
exit;
}
require_once 'includes/data_access.php';
$data_access = new DataAccess();
$scores = $data_access->get_highscores();
header('Content-Type: application/json');
echo json_encode($scores);