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


PHP storage::load方法代码示例

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


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

示例1: savecoins

 private static function savecoins($coins)
 {
     $old = storage::load();
     if (!$old) {
         $old = array();
     }
     foreach ($coins as $val => $ccs) {
         foreach ($ccs as $id => $coin) {
             $old[$val][$id] = $coin;
         }
     }
     if (storage::save($old)) {
         return true;
     }
     return false;
 }
开发者ID:perfectcode1,项目名称:Gcoin,代码行数:16,代码来源:mine.php

示例2: spentcoins

 public static function spentcoins($coins, $account)
 {
     if (!is_array($coins)) {
         return false;
     }
     $old = storage::load($account);
     if (!$old) {
         return false;
     }
     foreach ($coins as $id => $coin) {
         $val = $coin['value'];
         if (array_key_exists($id, $old[$val])) {
             unset($old[$val][$id]);
         }
     }
     $ret = storage::save($old, $account);
     $ret = $ret ? 1 : 0;
     return $ret;
 }
开发者ID:perfectcode1,项目名称:Gcoin,代码行数:19,代码来源:account.php

示例3: log

 public static function log(&$in)
 {
     list($oid, $t) = each($in);
     if (!is_array($t) || !isset($t['order id'])) {
         $t = $in;
         $oid = $t['order id'];
     }
     if (isset($t['coins'])) {
         unset($t['coins']);
     }
     if (isset($t['change'])) {
         unset($t['change']);
     }
     $acc = Tools::address($t['client']);
     $acm = Tools::address($t['merchant']);
     $ac = $acc['account'];
     $am = $acm['account'];
     $tr[$oid] = $t;
     if (account::exists($ac) || $ac == config::$accountId) {
         $oldc = storage::load("{$ac}.transaction");
         if (!$oldc) {
             $oldc = array();
         }
         $oldc[$oid] = $tr[$oid];
         storage::save($oldc, "{$ac}.transaction");
     }
     if (account::exists($am) || $am == config::$accountId) {
         $oldm = storage::load("{$am}.transaction");
         if (!$oldm) {
             $oldm = array();
         }
         $oldm[$oid] = $tr[$oid];
         storage::save($oldm, "{$am}.transaction");
     }
 }
开发者ID:perfectcode1,项目名称:Gcoin,代码行数:35,代码来源:transaction.php

示例4: log

 public static function log(&$t)
 {
     if (isset($t['coins'])) {
         unset($t['coins']);
     }
     if (isset($t['change'])) {
         unset($t['change']);
     }
     $tid = $t['acknowledgement']['id'];
     $tr[$tid] = $t;
     $old = storage::load('__Transactions__.lg');
     if (!$old) {
         $old = array();
     }
     $new = array_merge($old, $tr);
     storage::save($new, '__Transactions__.lg');
 }
开发者ID:perfectcode1,项目名称:Gcoin,代码行数:17,代码来源:transaction.php

示例5: pullcoins

 public static function pullcoins()
 {
     $m = Gmsg::create(Gmsg::prepare(GsonCrypt::sign(Gmsg::create(array('account' => config::$accountId))), 'pullcoins', config::$bankId));
     $net = new Gnet();
     $r = $net->send($m);
     $v = GsonCrypt::verify($r, config::$bankId);
     if (!$v) {
         $status = 0;
         gio::log("Unable to verify response from bank while pulling coins", E_USER_WARNING);
     } else {
         $v = Gmsg::extract($v);
         if (!$v) {
             $status = 0;
             gio::log("Unable to understand the response while pulling coins", E_USER_WARNING);
         } else {
             $status = $v['status'];
             $res = $v['response'];
         }
     }
     if (!$status) {
         gio::output("Could not pull eCash from bank");
     } else {
         if (!is_array($res)) {
             gio::output("Could not pull eCash from bank");
         } else {
             $check = 1;
             foreach ($res as $val => $ccs) {
                 foreach ($ccs as $id => $coin) {
                     $res[$val][$id]['secret'] = GsonCrypt::unseal($coin['secret']);
                     if (!$res[$val][$id]['secret']) {
                         $check = 0;
                     }
                 }
             }
             if (!$check) {
                 gio::output("Could not get the secret of some eCash");
             }
         }
         if (is_array($res) && count($res)) {
             $old = storage::load();
             if (!$old) {
                 $old = array();
             }
             foreach ($res as $val => $ccs) {
                 foreach ($ccs as $id => $coin) {
                     $val = $coin['value'];
                     $old[$val][$id] = $coin;
                 }
             }
             storage::save($old);
         }
     }
 }
开发者ID:perfectcode1,项目名称:Gcoin,代码行数:53,代码来源:account.php

示例6: spentcoins

 public static function spentcoins($coins, $account)
 {
     if (!is_array($coins) || $account != config::$accountId && !account::exists($account)) {
         return false;
     }
     if (!is_array($coins)) {
         return false;
     }
     $dest = strtolower($account) == strtolower(config::$accountId) ? config::$walfile : $account;
     $old = storage::load($dest);
     if (!$old) {
         return false;
     }
     foreach ($coins as $id => $coin) {
         $val = $coin['value'];
         if (array_key_exists($id, $old[$val])) {
             unset($old[$val][$id]);
         }
     }
     $ret = storage::save($old, $dest);
     $ret = $ret ? 1 : 0;
     return $ret;
 }
开发者ID:perfectcode1,项目名称:Gcoin,代码行数:23,代码来源:account.php

示例7: balance

 public static function balance(&$coins)
 {
     self::pullcoins();
     $coins = storage::load();
     if (!$coins) {
         $coins = array();
     }
     $cnt = 0;
     foreach ($coins as $val => $ccs) {
         $cnt += intval(count($ccs)) * intval($val);
     }
     return $cnt;
 }
开发者ID:perfectcode1,项目名称:Gcoin,代码行数:13,代码来源:account.php

示例8: explode

 /**
 	Get database object
 		@param $force_reload boolean
 		@public
 	**/
 static function &getDBO($force_reload = false)
 {
     static $dbo;
     if ($force_reload) {
         // re-init db instance
         $dbo = null;
     }
     // create if don't exists
     if (!is_object($dbo)) {
         $config = Factory::getConfig();
         // extract timezone for DB
         @(list($tz_script, $tz_db) = explode('|', $config->timezone));
         $storage = new storage();
         // set timezone
         $storage->set_timezone($tz_db);
         // load db instance
         $dbo = $storage->load($config->dsn);
         if (!$dbo) {
             die('Cannot connect to database.');
         }
     }
     return $dbo;
 }
开发者ID:rudenyl,项目名称:kcms,代码行数:28,代码来源:framework.php


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