當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ArrayData::getField方法代碼示例

本文整理匯總了PHP中ArrayData::getField方法的典型用法代碼示例。如果您正苦於以下問題:PHP ArrayData::getField方法的具體用法?PHP ArrayData::getField怎麽用?PHP ArrayData::getField使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ArrayData的用法示例。


在下文中一共展示了ArrayData::getField方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testSetField

 function testSetField()
 {
     $arrayData = new ArrayData(array());
     $arrayData->setField('d', 'Delta');
     $this->assertTrue($arrayData->hasField('d'));
     $this->assertEquals('Delta', $arrayData->getField('d'));
 }
開發者ID:,項目名稱:,代碼行數:7,代碼來源:

示例2: view

 public function view(SS_HTTPRequest $request)
 {
     $params = $request->params();
     $game_id = $params['ID'];
     $game = Game::get()->filter('ID', $game_id)->first();
     $teams = $game->Teams();
     $allTeams = array();
     foreach ($teams as $team) {
         $teamArr = array();
         $player_one = Player::get()->filter('ID', $team->PlayerOne)->first();
         $player_two = Player::get()->filter('ID', $team->PlayerTwo)->first();
         $teamArr['Names'] = $player_one->Name . ' & ' . $player_two->Name;
         $teamArr['GamesPlayed'] = $team->getGamesPlayed();
         $teamArr['TeamID'] = $team->ID;
         if ($allTeams == array()) {
             $allTeams['TeamOne'] = $teamArr;
         } else {
             $allTeams['TeamTwo'] = $teamArr;
         }
     }
     $link = $this->Link();
     $data = new ArrayData(array('Teams' => $allTeams, 'ParentLink' => $link, 'Winner' => $game->Winner, 'Score' => $game->ScoreTeamOne . '-' . $game->ScoreTeamTwo));
     if ($data->getField('Teams') == array()) {
         $data = new ArrayData(array('Content' => 'There are no teams assigned to this game.', 'AddNewTeam' => '<a href="' . $link . 'assignteams/' . $game_id . '" class="btn btn-success">Assign a Team to this game</a>', 'ParentLink' => $this->Link()));
         Session::set('GameID', $game_id);
     }
     return $data->renderWith(array('Game', 'Page'));
 }
開發者ID:jackmarchant,項目名稱:foosfirst,代碼行數:28,代碼來源:GamesPage.php


注:本文中的ArrayData::getField方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。