本文整理汇总了PHP中API::GenerateResponse方法的典型用法代码示例。如果您正苦于以下问题:PHP API::GenerateResponse方法的具体用法?PHP API::GenerateResponse怎么用?PHP API::GenerateResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类API
的用法示例。
在下文中一共展示了API::GenerateResponse方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetSimpleSpell
public static function GetSimpleSpell($SpellID, $JSONP)
{
$SpellInfo = Spells::SpellInfo($SpellID);
if ($SpellInfo) {
$SpellData = Text::RemapArray($SpellInfo, ['SpellID', 'Name', 'Description', 'icon'], ['id', 'name', 'description', 'icon']);
parent::Encode($SpellData, $JSONP);
} else {
parent::GenerateResponse(404, true);
}
}
示例2: GetSimpleAchievement
public static function GetSimpleAchievement($AchievementID, $JSONP)
{
$Statement = parent::$DBConnection->prepare('SELECT a.id, a.faction as factionID, a.name_loc0 as title, a.description_loc0 as description, a.points, a.reward_loc0 as reward, LOWER(si.iconname) as icon FROM freedomcore_achievement a LEFT JOIN freedomcore_spellicons si ON a.icon = si.id WHERE a.id = :aid');
$Statement->bindParam(':aid', $AchievementID);
$Statement->execute();
$Result = $Statement->fetch(PDO::FETCH_ASSOC);
if ($Statement->rowCount() > 0) {
$GetAchievementCriterias = AchievementAPI::GetAchievementCriteria($AchievementID);
foreach ($GetAchievementCriterias as $Criteria) {
$Result['criteria'][] = $Criteria;
}
return parent::Encode($Result, $JSONP);
} else {
return parent::GenerateResponse(404, true);
}
}
示例3: switch
DataAPI::CharacterClasses($_REQUEST['jsonp']);
break;
default:
API::GenerateResponse(403, true);
break;
}
break;
case 'item':
switch ($_REQUEST['datatype']) {
case 'classes':
DataAPI::ItemClasses($_REQUEST['jsonp']);
break;
default:
API::GenerateResponse(403, true);
break;
}
break;
default:
API::GenerateResponse(403, true);
break;
}
break;
default:
header('Content-Type: text/html; charset=utf-8');
$Smarty->translate('Developer');
$Smarty->assign('Page', Page::Info('dev', array('bodycss' => '', 'pagetitle' => $Smarty->GetConfigVars('Developer_Page_Title') . ' - ')));
$Smarty->display('developer');
break;
}
break;
}
示例4: VerifyRequestEligibility
public static function VerifyRequestEligibility($SecondsPerRequest)
{
if (!isset($_SESSION['last_request_time'])) {
$_SESSION['last_request_time'] = $SecondsPerRequest;
Session::UpdateSession($_SESSION);
}
if ($_SESSION['last_request_time'] && time() - $_SESSION['last_request_time'] > $SecondsPerRequest) {
$_SESSION['last_request_time'] = time();
Session::UpdateSession($_SESSION);
} else {
API::GenerateResponse(429, true);
}
}
示例5: GetItemSet
public static function GetItemSet($SetID, $JSONP)
{
$Statement = parent::$DBConnection->prepare('SELECT * FROM freedomcore_itemset WHERE itemsetID = :setid');
$Statement->bindParam(':setid', $SetID);
$Statement->execute();
$Result = $Statement->fetch(PDO::FETCH_ASSOC);
if ($Statement->rowCount() > 0) {
$FinalArray = [];
$FinalArray['id'] = $Result['itemsetID'];
$FinalArray['name'] = $Result['name_loc0'];
$i = 8;
while ($i > 0) {
if ($Result['bonus' . $i] != 0) {
$FinalArray['setBonuses'][] = ['description' => Spells::SpellInfo($Result['spell' . $i])['Description'], 'threshold' => $Result['bonus' . $i]];
}
$i--;
}
$SetItems = [];
for ($i = 1; $i <= 10; $i++) {
if ($Result['item' . $i] != 0) {
$SetItems[] = $Result['item' . $i];
}
}
$FinalArray['items'] = $SetItems;
parent::Encode($FinalArray, $JSONP);
} else {
parent::GenerateResponse(404, true);
}
}