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


PHP API::Encode方法代码示例

本文整理汇总了PHP中API::Encode方法的典型用法代码示例。如果您正苦于以下问题:PHP API::Encode方法的具体用法?PHP API::Encode怎么用?PHP API::Encode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在API的用法示例。


在下文中一共展示了API::Encode方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GetResetStatus

 public static function GetResetStatus($JSONP)
 {
     $WorldStates = [20001, 20002, 20003, 20006, 20007];
     $Response = [];
     $Statement = parent::$CharConnection->prepare('SELECT * from worldstates WHERE entry IN(20001, 20002, 20003, 20006, 20007);');
     $Statement->execute();
     $Result = $Statement->fetchAll(PDO::FETCH_ASSOC);
     if (Database::IsEmpty($Statement)) {
         foreach ($WorldStates as $ID) {
             $Response[] = [ArmoryAPI::GetWorldstateByID($ID) => '0'];
         }
     } else {
         foreach ($Result as $WS) {
             foreach ($WorldStates as $ID) {
                 if ($ID == $WS['entry']) {
                     $Response[] = [ArmoryAPI::GetWorldstateByID($ID) => $WS['value']];
                     break;
                 } else {
                     $Response[] = [ArmoryAPI::GetWorldstateByID($WS['entry']) => '0'];
                     break;
                 }
             }
         }
     }
     return parent::Encode($Response, $JSONP, "wsrt");
 }
开发者ID:Expecto,项目名称:FreedomCore,代码行数:26,代码来源:Armory.FreedomCoreAPI.php

示例2: 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);
     }
 }
开发者ID:anonymous33rus,项目名称:FreedomCore,代码行数:10,代码来源:Spell.FreedomCoreAPI.php

示例3: ItemClasses

 public static function ItemClasses($JSONP)
 {
     $Result = Items::ItemSubClass(null, null, false, true);
     $JSONArray = [];
     foreach ($Result as $Key => $Value) {
         $ClassArray = [];
         $ClassArray['class'] = $Key;
         $ClassArray['name'] = Items::ItemClass($Key)['translation'];
         $ClassArray['subclasses'] = [];
         foreach ($Value as $SKey => $SValue) {
             $ClassArray['subclasses'][] = ['subclass' => $SValue['subclass'], "name" => $SValue['translation']];
         }
         $JSONArray[] = $ClassArray;
     }
     parent::Encode($JSONArray, $JSONP, 'classes');
 }
开发者ID:anonymous33rus,项目名称:FreedomCore,代码行数:16,代码来源:Data.FreedomCoreAPI.php

示例4: 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);
     }
 }
开发者ID:Expecto,项目名称:FreedomCore,代码行数:16,代码来源:Achievement.FreedomCoreAPI.php

示例5: GetCharacters

 public static function GetCharacters($Username, $Password, $JSONP)
 {
     $GameData = AccountAPI::GetUserBasicData($Username, $Password);
     if (isset($GameData['code'])) {
         return parent::Encode($GameData, $JSONP);
     } else {
         $Statement = parent::$CharConnection->prepare('SELECT name, race, class, gender, level, money FROM characters WHERE account = :accountid');
         $Statement->bindParam(":accountid", $GameData['id']);
         $Statement->execute();
         $Result = $Statement->fetchAll(PDO::FETCH_ASSOC);
         $ArrayIndex = 0;
         foreach ($Result as $Character) {
             $Result[$ArrayIndex]['race'] = Characters::GetRaceByID($Character['race']);
             $Result[$ArrayIndex]['class'] = Characters::GetClassByID($Character['class']);
             $Result[$ArrayIndex]['class'] = Characters::GetClassByID($Character['class']);
             $Result[$ArrayIndex]['money'] = Text::MoneyToCoins($Character['money']);
             $ArrayIndex++;
         }
         return parent::Encode($Result, $JSONP, "characters");
     }
 }
开发者ID:Expecto,项目名称:FreedomCore,代码行数:21,代码来源:Account.FreedomCoreAPI.php

示例6: 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);
     }
 }
开发者ID:anonymous33rus,项目名称:FreedomCore,代码行数:29,代码来源:Item.FreedomCoreAPI.php


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