本文整理匯總了PHP中PDO::openGame方法的典型用法代碼示例。如果您正苦於以下問題:PHP PDO::openGame方法的具體用法?PHP PDO::openGame怎麽用?PHP PDO::openGame使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PDO
的用法示例。
在下文中一共展示了PDO::openGame方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: unserialize
/**
* @param DB $db
* @param int|null $id
* @param int $width
* @param int $height
* @param int $line
*/
function __construct(DB $db, array $users, $id = null, $width = 3, $height = 3, $line = 3)
{
$this->db = $db;
if (!empty($id)) {
$game = unserialize($this->db->openGame($id));
if (!empty($game)) {
$this->id = $id;
$this->users = $game['users'];
$this->line = $game['game']['line'];
$this->grid = new Grid($game['game']['width'], $game['game']['height']);
} else {
print "Такой игры не обнаружено";
exit;
}
} else {
foreach ($users as $user) {
$this->users[] = new User($user);
}
$this->line = $line;
$this->grid = new Grid($width, $height);
}
$this->grid->drawGrid($this->users);
$u = $this->getCurrentGamer();
print "\nХод " . $this->getCurrentGamer()->name . "\n";
}