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


PHP game::insert方法代碼示例

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


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

示例1: opendir

mysql_select_db("war3", $con);
$dirPath = '/Users/michael/war3/WarcraftReplays/';
$dh = opendir($dirPath);
$counter = 0;
while (($file = readdir($dh)) !== false) {
    if ($file[0] == '.') {
        continue;
    }
    if (!is_dir($dirPath . $file)) {
        continue;
    }
    echo "directory={$file}\n";
    //ok, go into the directory
    $dh2 = opendir($dirPath . $file);
    while (($warfile = readdir($dh2)) !== false) {
        if ($warfile[0] == '.') {
            continue;
        }
        $filename = $dirPath . $file . '/' . $warfile;
        if (is_dir($filename)) {
            continue;
        }
        echo "{$counter}: file=" . $filename . "\n";
        $counter++;
        $game = new game($filename);
        $game->insert($con);
    }
    closedir($dh2);
}
closedir($dh);
mysql_close($con);
開發者ID:holidaymike,項目名稱:war3,代碼行數:31,代碼來源:parser.php

示例2: current

        // insert the team_before to the database, then reset the team_before
        // add the score into the team_before.
        // var_dump($team_before);
        $score1 = current($team_before);
        $key1 = key($team_before);
        next($team_before);
        $score2 = current($team_before);
        $key2 = key($team_before);
        if ($score1 >= $score2) {
            $winner = [$key1 => $score1];
            $loser = [$key2 => $score2];
        } else {
            $winner = [$key2 => $score2];
            $loser = [$key1 => $score1];
        }
        $result = game::insert(key($winner), key($loser), current($winner), current($loser), $team_before[0]);
        // var_dump($result);
        $result = (array) $result;
        $game_id = $result["game_id"];
        $team1 = $result["Team1"];
        $team2 = $result["Team2"];
        printf("insert Game " . "{$game_id}: " . "{$team1}" . " and " . "{$team2}" . " succeeded!");
        ?>
		<br>
		<?php 
        // start to store the new game. Skip the last empty $game_i
        if (count($game_i) > 1) {
            unset($team_before);
            $team_before = [$game_i[2] => 0, $game_i[3] => 0, $game_i[4]];
            if ($game_i[5] == "fieldgoal") {
                $team_before[$game_i[2]] += 3;
開發者ID:HongkunGe,項目名稱:footBallScoreManage,代碼行數:31,代碼來源:GameDatabase.php


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