當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。