本文整理汇总了PHP中REST::returnJson方法的典型用法代码示例。如果您正苦于以下问题:PHP REST::returnJson方法的具体用法?PHP REST::returnJson怎么用?PHP REST::returnJson使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类REST
的用法示例。
在下文中一共展示了REST::returnJson方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: readLesson
public function readLesson()
{
if (isset($this->inputs->last_time)) {
$logs = Mesalva::moreThan($this->inputs->last_time);
REST::returnJson(['status' => 'more', 'logs' => $logs]);
} else {
$logs = Mesalva::lastTen();
REST::returnJson(['status' => 'last', 'logs' => $logs]);
}
}
示例2: all
public function all()
{
$active = isset($_GET['active']) ? $_GET['active'] : 1;
$start = isset($_GET['start']) ? $_GET['start'] : 0;
$posts = Post::lasts($start, $active);
$where = 'TRUE';
if ($active !== null) {
$where = "estacao_post.active = " . ($active ? '1' : '0');
}
$query = "SELECT\n\t\t\t\testacao_post.*,\n\t\t\t\tusers.name gamer_name,\n\t\t\t\tusers.slug gamer_slug\n\t\t\tFROM estacao_post\n\t\t\tLEFT JOIN users\n\t\t\tON users.id = estacao_post.user_id\n\t\t\tWHERE {$where}\n\t\t\tORDER BY estacao_post.created_at DESC\n\t\t\tLIMIT 12\n\t\t\tOFFSET {$start}";
REST::returnJson(['status' => 'ok', 'posts' => $posts, 'query' => $query]);
}
示例3: return401
public static function return401($response = null)
{
header('HTTP/1.0 401 Unauthorized');
if ($response === null) {
$response = array('error' => true);
}
return REST::returnJson($response);
}
示例4: all
public function all()
{
$active = isset($_GET['active']) ? $_GET['active'] : 1;
$gamers = Gamer::all($active);
REST::returnJson(['status' => 'ok', 'gamers' => $gamers]);
}