当前位置: 首页>>代码示例>>PHP>>正文


PHP API::printJSON方法代码示例

本文整理汇总了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);
 }
开发者ID:TheEntropics,项目名称:TeamSpeak3-stats,代码行数:10,代码来源:API.php

示例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);
开发者ID:TheEntropics,项目名称:TeamSpeak3-stats,代码行数:8,代码来源:log.php

示例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));
开发者ID:TheEntropics,项目名称:TeamSpeak3-stats,代码行数:17,代码来源:realtime.php

示例4:

<?php

require_once __DIR__ . '/../API.php';
API::init();
$client_id = API::getClientId();
$daily = DailyUserUptimeVisualizer::getDailyUserUptime($client_id);
API::printJSON($daily);
开发者ID:TheEntropics,项目名称:TeamSpeak3-stats,代码行数:7,代码来源:daily.php

示例5:

<?php

require_once __DIR__ . '/../API.php';
API::init();
$client_id = API::getClientId();
$streak = StreakVisualizer::getStreak($client_id);
API::printJSON($streak);
开发者ID:TheEntropics,项目名称:TeamSpeak3-stats,代码行数:7,代码来源:streak.php

示例6:

<?php

require_once __DIR__ . '/../API.php';
API::init();
$lastDate = FooterVisualizer::getLastDate();
API::printJSON($lastDate);
开发者ID:TheEntropics,项目名称:TeamSpeak3-stats,代码行数:6,代码来源:lastUpdate.php

示例7:

<?php

require_once __DIR__ . '/../API.php';
API::init();
$counts = CounterVisualizer::getCounters();
API::printJSON($counts);
开发者ID:TheEntropics,项目名称:TeamSpeak3-stats,代码行数:6,代码来源:count.php

示例8:

<?php

require_once __DIR__ . '/../API.php';
API::init();
$channels = ChannelVisualizer::getChannels();
API::printJSON($channels);
开发者ID:TheEntropics,项目名称:TeamSpeak3-stats,代码行数:6,代码来源:all.php

示例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);
开发者ID:TheEntropics,项目名称:TeamSpeak3-stats,代码行数:17,代码来源:info.php

示例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);
开发者ID:TheEntropics,项目名称:TeamSpeak3-stats,代码行数:8,代码来源:scoreboard.php

示例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);
开发者ID:TheEntropics,项目名称:TeamSpeak3-stats,代码行数:9,代码来源:usernames.php


注:本文中的API::printJSON方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。