本文整理汇总了PHP中Card::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Card::create方法的具体用法?PHP Card::create怎么用?PHP Card::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Card
的用法示例。
在下文中一共展示了Card::create方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
DB::table('sides')->delete();
DB::table('cards')->delete();
$cid = Card::create(array())['id'];
echo $cid;
Side::create(array('card_id' => $cid, 'descriptor' => 'front', 'text' => 'front'));
Side::create(array('card_id' => $cid, 'descriptor' => 'back', 'text' => 'back'));
/*
Card::create(array('front' => 'hello',
'back' => 'back of card',
'count' => 10));
Card::create(array('front' => 'hello',
'back' => 'konnichiha',
'count' => 10));
*/
/*
for ($i=0; $i<1000; $i++) {
Card::create(array('front' => 'hello',
'back' => 'konnichiha',
'count' => 10));
}
*/
/*
*/
}
示例2: setCardsAttribute
public function setCardsAttribute($cards)
{
if (count($cards) > 0) {
foreach ($cards as $card) {
Card::create((array) $card);
}
}
}
示例3: json_encode
<?php
header("Content-Type:text/html; charset=utf-8");
include_once 'start/autoload.php';
// 玩家
$players = array("玩家1", "玩家2", "玩家3", "玩家4", "玩家5");
// 發牌
$cardObj = new Card();
$cards = $cardObj->create();
$cards = $cardObj->shuffle($cards);
$groups = $cardObj->Dealer(count($players), $cards);
// suit
$suit = $cardObj->suit();
echo json_encode($groups) . '<br>';
//$groups = json_decode('[[14,3,47,6,20,33,17,51,9,11,29],[21,13,7,5,34,8,40,10,30,12,31],[32,16,43,28,45,42,15,36,26,25],[23,38,52,22,39,27,2,44,24,49],[35,41,48,4,37,1,19,46,50,18]]');
// testing
foreach ($groups as $key => $val) {
echo '[' . $players[$key] . ']  ';
sort($val);
$cardObj->watch_card($val);
}
echo '<hr>';
// 遊戲開始
$flow = new Flow();
$tab = new Table();
$flow::$members = count($players);
// 第一手
$card = $flow->fire($groups);
$tab->add($card);
echo $players[$flow->now_player()] . ' : ' . $suit[$card] . '<br>';
for ($i = 0; $i < 55; $i++) {