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


PHP client::spend方法代码示例

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


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

示例1: foreach

             $assets = $client->getassets();
             $i = 1;
             $asset = false;
             foreach ($assets as $asset) {
                 if ($i == $assetidx) {
                     break;
                 }
                 $i++;
             }
             if (!$asset) {
                 echo "No such asset: {$assetidx}\n";
             } else {
                 $userid = $user['id'];
                 $assetid = $asset[$t->ASSET];
                 $note = "Spending {$amt}";
                 $err = $client->spend($userid, $assetid, $amt, $acct, $note);
                 if ($err) {
                     echo "{$err}\n";
                 }
             }
         }
     }
 } elseif ($cmd == 'cancel') {
     $cnt = count($tokens);
     if ($cnt != 2) {
         echo "Usage is: cancel <spend#>\n";
     } else {
         $time = $tokens[1];
         $err = $client->spendreject($time, "Cancelling {$time}");
         if ($err) {
             echo "{$err}\n";
开发者ID:billstclair,项目名称:trubanc,代码行数:31,代码来源:clientest.php

示例2: doit


//.........这里部分代码省略.........
            if (file_exists('client/settings.php')) {
                require_once "client/settings.php";
            }
            $dbdir = "client/{$dbdir}";
            $template_file = "client/{$template_file}";
            $error = die_unless_client_properly_configured(true);
            if (!$error) {
                require_once "lib/client.php";
                $clientdb = new fsdb("{$dbdir}");
                $client = new client($clientdb, $ssl);
                if ($enabledebug) {
                    $client->showprocess = 'appenddebug';
                }
                $hash = $client->passphrasehash($passphrase);
                if (!$clientdb->get("privkey/{$hash}")) {
                    // Create the new account
                    $error = $client->newuser($passphrase);
                } else {
                    $error = $client->login($passphrase);
                }
                if (!$error) {
                    $id = $client->id;
                    if ($clientdb->get("account/{$id}/bank/{$bankid}/req")) {
                        $error = 'Account already exists for that passphrase. ' . 'Use the <a href="client/">client interface</a> to administer.';
                    } else {
                        $error = $client->login($bankpass);
                        if (!$error) {
                            $error = $client->addbank($bankurl);
                        }
                        if (!$error) {
                            $error = $client->setbank($bankid);
                        }
                        if (!$error) {
                            $error = $client->spend($id, $tokenid, "10000");
                        }
                        if ($error) {
                            $error = "While spending tokens from bank: {$error}";
                        }
                    }
                    if (!$error) {
                        $error = $client->login($passphrase);
                        if (!$error) {
                            $error = $client->addbank($bankurl, $name);
                        }
                        if (!$error) {
                            ?>
<p>Your bank is now ready for business. You may now login as administrator in the
<a href="client/">Client interface</a>, accept your initial tokens from
the bank, and start inviting customers.</p>
<?php 
                            return;
                        }
                    }
                }
            }
        }
    }
    if (!$error) {
        $error = "&nbsp;";
    }
    if ($drawadmin) {
        ?>
<p>Congratulations! You have succesfully initialized your bank.</p>

<p>Use the form below to create an administration account for your bank.
Use the bank's account only to spend usage tokens to the administration account.
开发者ID:billstclair,项目名称:trubanc,代码行数:67,代码来源:bankinit.php


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