本文整理汇总了PHP中Character::getCharacter方法的典型用法代码示例。如果您正苦于以下问题:PHP Character::getCharacter方法的具体用法?PHP Character::getCharacter怎么用?PHP Character::getCharacter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Character
的用法示例。
在下文中一共展示了Character::getCharacter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Character
$newchar->addCard($newcard);
$newchar->saveCharacter();
//$newchar->printCharInfo();
echo '<br /><br />Adding a second card: ';
$testcard->printCardInfo();
$newchar->addCard($testcard);
$newchar->saveCharacter();
echo '<br /><br />Resulting character: ';
$newchar->printCharInfo();
echo '<br /><br />Removed a card: ';
$newchar->removeCard($newcard);
$newchar->saveCharacter();
$newchar->printCharInfo();
echo '<br /><br />Get a copy of the character from the DB';
$charcopy = new Character($uidtotest, '', 0);
$charcopy->getCharacter($newchar->getCharID(), $uidtotest);
echo '<br /><br />Comparing the copy to the original: ';
//$newchar->printCharInfo();
$newchar_str = $newchar->strRepresentation();
//$charcopy->printCharInfo();
$charcopy_str = $charcopy->strRepresentation();
if ($newchar_str == $charcopy_str) {
//Then the original and copy are the same.
print "<br />The two character objects <font color='green'>match</font> as expected - <br />";
$newchar->printCharInfo();
$goodtests++;
} else {
print "<br />The original object <font color='red'>does not</font> match the copy of the object as expected.<br />";
$newchar->printCharInfo();
print "<br /><br />";
$charcopy->printCharInfo();
示例2: serialize
break;
case 'save_character':
if (!$char) {
echo json_encode("failure");
} else {
$char->saveCharacter();
$_SESSION['char'] = serialize($char);
}
break;
case 'del_character':
if (!isset($_POST['charid'])) {
echo json_encode("failure");
} else {
$charid = intval($_POST['charid']);
$delchar = new Character($userid, '', 0);
$delchar->getCharacter($charid, $userid);
if ($delchar->getCharID() == $char->getCharID()) {
$_SESSION['char'] = serialize(new Character($userid, '', 0));
}
$delchar->delCharacter();
}
break;
case 'get_charid':
if (!$char) {
echo json_encode("failure");
} else {
echo json_encode("" . $char->getCharID());
}
break;
case 'set_charname':
if (!$char) {