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


PHP Currency::setCode方法代码示例

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


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

示例1: addToCollection

 protected function addToCollection($currencyParams, $currencyCollection)
 {
     $currencyObj = new Currency();
     $currencyObj->setSource($currencyParams['source']);
     $currencyObj->setType($currencyParams['type']);
     $currencyObj->setCode($currencyParams['code']);
     $currencyObj->setName($currencyParams['name']);
     $currencyObj->setPrice(floatval(str_replace(',', '.', $currencyParams['price'])));
     $currencyCollection->add($currencyObj);
 }
开发者ID:dneprix,项目名称:esky,代码行数:10,代码来源:CurrencyFactoryAbstract.php

示例2: readUnits

 public function readUnits()
 {
     $con = self::openConnection();
     $currencies = new Currencies();
     mysqli_begin_transaction($con);
     $sql = "SELECT * FROM currency WHERE 1";
     $res = mysqli_query($con, $sql);
     while ($arrRes = mysqli_fetch_assoc($res)) {
         $currency = new Currency();
         $currency->setId($arrRes['id']);
         $currency->setCode($arrRes['code']);
         $currencies->setUnit($currency);
     }
     return $currencies;
 }
开发者ID:Voww,项目名称:PHP_test_tasks,代码行数:15,代码来源:CurrencyDAO.php

示例3: getCurrencies

 protected function getCurrencies()
 {
     $wikipedia = $this->web->get(sfConfig::get('app_source_currencies'), null, array('User-Agent' => 'Steve Lacey <steve@stevelacey.net>', 'Cache-Control' => 'no-cache'));
     $xml = new SimpleXMLElement($wikipedia->getResponseText());
     $article = $xml->page->revision->text;
     $table = substr($article, strpos($article, '{|'), strpos($article, '|}') - strpos($article, '{|'));
     foreach (explode('-| ', str_replace(array('[', ']', "\n"), '', $table)) as $row) {
         $row = explode(' || ', trim($row, '| '));
         if (isset($row[2], $row[4]) && is_numeric($row[2])) {
             $currency = new Currency();
             $currency->setCode(sfConfig::get('app_currency_alias_' . $row[0], $row[0]));
             $currency->setNumber($row[1]);
             $currency->setDigits(ceil($row[2]));
             $currency->setName($row[3]);
             $currency->save();
         }
     }
 }
开发者ID:asaraf28,项目名称:CurrencyConverter,代码行数:18,代码来源:getCurrenciesTask.class.php

示例4: parseCurrencies

 public function parseCurrencies()
 {
     $currencies = new Currencies();
     $keyParams = array();
     foreach ($this->xmlProducts as $product) {
         $cur = $product->getCurrency();
         if (!empty($cur) && !in_array($cur, $keyParams)) {
             array_push($keyParams, $cur);
             $currency = new Currency();
             $currency->setCode($cur);
             $currencies->setUnit($currency);
         }
     }
     $currencyDAO = new CurrencyDAO();
     $currencyDAO->insertUnits($currencies);
     $currencies = $currencyDAO->readUnits();
     return $currencies;
 }
开发者ID:Voww,项目名称:PHP_test_tasks,代码行数:18,代码来源:XMLParser.php


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