当前位置: 首页>>代码示例>>PHP>>正文


PHP Character::getCharID方法代码示例

本文整理汇总了PHP中Character::getCharID方法的典型用法代码示例。如果您正苦于以下问题:PHP Character::getCharID方法的具体用法?PHP Character::getCharID怎么用?PHP Character::getCharID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Character的用法示例。


在下文中一共展示了Character::getCharID方法的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();
开发者ID:JohnBean,项目名称:i3-character-creator,代码行数:31,代码来源:backend_unittests.php

示例2: serialize

 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) {
         echo json_encode("failure");
开发者ID:JohnBean,项目名称:i3-character-creator,代码行数:31,代码来源:char_controller.php


注:本文中的Character::getCharID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。