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


PHP Character::delete方法代码示例

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


在下文中一共展示了Character::delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testDelete

 /**
  * 
  * @expectedException StatusCodeException
  */
 public function testDelete()
 {
     require __DIR__ . '/config/database_test.php';
     $db = new DatabaseConnection($host, $database, $user, $password);
     $character1 = ['name' => 'Lion Woods', 'description' => 'A wonderful zombie that plays golf better than Tiger Woods', 'type' => 'zombie', 'dead' => '1', 'stage' => '2', 'hp' => '67'];
     $id1 = Character::insert($db, $character1);
     $this->assertTrue(is_array(Character::find($db, $id1)), 'testDelete could not be done cause Character could not be inserted to be deleted.');
     Character::delete($db, $id1);
     $this->assertFalse(is_array(Character::find($db, $id1)), 'Character::delete not worked properly.');
 }
开发者ID:rafamalaga86,项目名称:gamerest,代码行数:14,代码来源:TestCharacter.php

示例2: deleteCharacter

 /**
  * Update a character with that ID
  *
  * @param DatabaseConnection database class instance
  * @param mixed $id number, could be a string or an int
  * @return string '{}'
  */
 public function deleteCharacter(DatabaseConnection $db, $id)
 {
     Character::find($db, $id);
     Character::delete($db, $id);
     return '{}';
 }
开发者ID:rafamalaga86,项目名称:gamerest,代码行数:13,代码来源:CharacterController.php

示例3: Character

 function character_delete()
 {
     if (!$this->delete('id')) {
         $this->response('', 400);
     }
     // Are we logged in?
     if (!$this->user->exists()) {
         $this->response(NULL, 401);
     }
     $character = new Character($this->delete('id'));
     // Only allow deleting of your own characters
     if ($this->user->id != $character->player_id) {
         $this->response(NULL, 401);
     }
     $character->delete();
     $this->response('Character deleted', 200);
 }
开发者ID:TetsujinOni,项目名称:PFS-Scenariotracker,代码行数:17,代码来源:V1.php


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