本文整理汇总了PHP中API::printJSON方法的典型用法代码示例。如果您正苦于以下问题:PHP API::printJSON方法的具体用法?PHP API::printJSON怎么用?PHP API::printJSON使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类API
的用法示例。
在下文中一共展示了API::printJSON方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getClientId
public static function getClientId()
{
$client_id = intval(API::getParam('client_id'));
if (!$client_id) {
http_response_code(400);
API::printJSON(["error" => "Please specify a valid client_id"]);
return;
}
return User::getMasterClientId($client_id);
}
示例2:
<?php
require_once __DIR__ . '/../API.php';
API::init();
$limit = API::getParam('limit', 10);
$offset = API::getParam('offset', 0);
$log = LogVisualizer::getLastLog($limit, $offset);
API::printJSON($log);
示例3: http_response_code
<?php
require_once __DIR__ . '/../API.php';
API::init();
if (!Config::get("realtime.enabled")) {
http_response_code(403);
API::printJSON(array('error' => 'Realtime disabled'));
}
try {
$ts3 = new Ts3ServerQuery(Config::get("realtime.host"), Config::get("realtime.port", 10011), Config::get("realtime.username", "serveradmin"), Config::get("realtime.password"));
$users = RealtimeUsers::getOnlineUsers($ts3);
$channels = RealtimeChannels::getChannels($ts3);
} catch (Exception $e) {
http_response_code(500);
API::printJSON(array('error' => 'Boh...'));
}
API::printJSON(RealtimeFormatter::getRealtime($users, $channels));
示例4:
<?php
require_once __DIR__ . '/../API.php';
API::init();
$client_id = API::getClientId();
$daily = DailyUserUptimeVisualizer::getDailyUserUptime($client_id);
API::printJSON($daily);
示例5:
<?php
require_once __DIR__ . '/../API.php';
API::init();
$client_id = API::getClientId();
$streak = StreakVisualizer::getStreak($client_id);
API::printJSON($streak);
示例6:
<?php
require_once __DIR__ . '/../API.php';
API::init();
$lastDate = FooterVisualizer::getLastDate();
API::printJSON($lastDate);
示例7:
<?php
require_once __DIR__ . '/../API.php';
API::init();
$counts = CounterVisualizer::getCounters();
API::printJSON($counts);
示例8:
<?php
require_once __DIR__ . '/../API.php';
API::init();
$channels = ChannelVisualizer::getChannels();
API::printJSON($channels);
示例9: isset
<?php
require_once __DIR__ . '/../API.php';
API::init();
$client_id = API::getClientId();
$username = ProbableUsernameVisualizer::getProbableUsername($client_id);
$online = OnlineRange::getOnlineRanges();
$is_online = isset($online[$client_id]);
if ($is_online) {
$online_since = $online[$client_id]->start;
$online_for = (new DateTime())->getTimestamp() - $online_since->getTimestamp();
} else {
$online_since = null;
$online_for = 0;
}
$info = ["client_id" => $client_id, "username" => $username, "online" => $is_online, "online_since" => $online_since, "online_for" => $online_for];
API::printJSON($info);
示例10:
<?php
require_once __DIR__ . '/../API.php';
API::init();
$limit = API::getParam('limit', 50);
$offset = API::getParam('offset', 0);
$scoreboard = UptimeVisualizer::getUptimeScoreboard($limit, $offset);
API::printJSON($scoreboard);
示例11:
<?php
require_once __DIR__ . '/../API.php';
API::init();
$client_id = API::getClientId();
$limit = API::getParam('limit', 10);
$offset = API::getParam('offset', 0);
$usernames = UsernameUptimeVisualizer::getUsernameUptime($client_id, $limit, $offset);
API::printJSON($usernames);