本文整理汇总了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);
示例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;