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


PHP Factory::getDatabase方法代码示例

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


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

示例1: __construct

 function __construct($id)
 {
     $this->db = Factory::getDatabase();
     $res = $this->db->query("select * from user where id = {$id} limit 1");
     $this->data = $res->fetch_assoc();
     $this->id = $id;
 }
开发者ID:lisiqiong,项目名称:imoocMvc,代码行数:7,代码来源:User.php

示例2: resolveDestinationPath

 public function resolveDestinationPath($dir, $sourceInfo)
 {
     $log = Factory::getLogger();
     $res = $this->mPeeler->resolveDestinationPath($dir, $sourceInfo);
     $c = $this->getConfig();
     $db = Factory::getDatabase();
     switch ($c['peeler']['unique_by']) {
         case 'url':
             if ($db->urlDownloaded($sourceInfo['url'])) {
                 $log->message('Skipping %s (already downloaded)', $sourceInfo['url']);
                 $res = null;
             }
             break;
         case 'checksum':
             break;
     }
     return $res;
 }
开发者ID:espena,项目名称:peel,代码行数:18,代码来源:peeler__unique_by.inc.php

示例3: download

 private function download($dir)
 {
     $c = $this->getConfig();
     $db = Factory::getDatabase();
     $log = Factory::getLogger();
     $data = $this->mPeeler->getData();
     $scraper = Factory::createScraper();
     foreach ($data as $sourceInfo) {
         $url = $sourceInfo['url'];
         $log->message("Found %s", basename($url));
         $scraper->get($url);
         $res = $scraper->getResponseCode();
         if ($dest = $this->resolveDestinationPath($dir, $sourceInfo)) {
             if ($res == 200) {
                 $log->message("Writing %s", $dest);
                 file_put_contents($dest, $scraper->getResponseData());
                 $db->registerUrlDownloaded($url, $c['peeler']['name'], $dest, 'naming_ok');
             } else {
                 $log->error("Server status %s", $res, $url);
             }
         }
     }
 }
开发者ID:espena,项目名称:peel,代码行数:23,代码来源:peeler__download_to.inc.php

示例4: __construct

 function __construct()
 {
     $db = Factory::getDatabase();
     $result = $db->query("select id from user");
     $this->ids = $result->fetch_all(MYSQLI_ASSOC);
 }
开发者ID:lisiqiong,项目名称:imoocMvc,代码行数:6,代码来源:AllUser.php

示例5: authenticate

 private function authenticate()
 {
     if (empty($_SESSION['login']) && isset($_SESSION['post'])) {
         $db = Factory::getDatabase();
         $_SESSION['login'] = $db->verifyUser($_SESSION['post']['u'], $_SESSION['post']['p']);
     }
     unset($_SESSION['post']);
     return !empty($_SESSION['login']);
 }
开发者ID:espena,项目名称:peel,代码行数:9,代码来源:app_login.inc.php

示例6: setUserName

 function setUserName($id, $name)
 {
     $db = Factory::getDatabase('master');
     $db->query("update user set name = {$name} where id ={$id} limit 1");
 }
开发者ID:lisiqiong,项目名称:imoocMvc,代码行数:5,代码来源:Proxy.php


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