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


PHP DatabaseFactory::getDatabase方法代码示例

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


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

示例1: __construct

 function __construct()
 {
     $this->db = DatabaseFactory::getDatabase();
     $this->de = new WarOfNationsDataExtractor($this->db);
     // We always need authentication, so just initialize it now
     $this->auth = new WarOfNationsAuthentication($this->db, $this->de, $this->data_load_id);
 }
开发者ID:scornfield,项目名称:won-data-extractor,代码行数:7,代码来源:WarOfNations2.class.php

示例2: while

// Kijkt dat file bestaat
if ($csvParser->checkIfFileExist()) {
    // Lees regel CSV bestand
    $row = 0;
    $dataArray = [];
    if ($csvParser->setHandle($csvParser->openFile("r")) !== FALSE) {
        // Controleert of data is gevonden
        while (($data = $csvParser->lineCSV($csvParser->getHandle())) !== FALSE) {
            if ($row == 0) {
                $row++;
                continue;
            }
            $num = count($data);
            // Zet regel op het scherm
            echo "<p> {$num} velden in lijn {$row}: <br /></p>\n";
            $database = DatabaseFactory::getDatabase();
            $user = new UserController(new DbUser($database));
            $user->setFirstName($data[DATA_POS_FN]);
            $user->setLastName($data[DATA_POS_LN]);
            $user->setMobile($data[DATA_POS_MOB]);
            $user->setTelephone($data[DATA_POS_TEL]);
            echo $user->getFirstName() . "<br/>";
            echo $user->getLastName() . "<br/>";
            echo $user->getMobile() . "<br/>";
            echo $user->getTelephone() . "<br/>";
            // Check lengte en start met 0
            // check mobile nummers
            if (strlen($data[DATA_POS_MOB]) != MOB_LENGTH || substr($data[DATA_POS_MOB], 0, 1) != "0") {
                // Als er een fout is schrijf naar foutbestand negeert het als het er al instaat
                if ($logger->checkInFile($loggerUri, $data) == false) {
                    $logger->writeInFile($loggerUri, $data);
开发者ID:infinityart,项目名称:kerntaak4,代码行数:31,代码来源:index.php

示例3: dirname

<?php

require_once dirname(__FILE__) . '/classes/data/DatabaseFactory.class.php';
require_once dirname(__FILE__) . '/classes/data/Proxy.class.php';
$debug = false;
// This is the page that that we're going to request going through the proxy
$testpage = "http://gcand.gree-apps.net/hc//index.php/json_gateway";
$checktext = "Json_gateway?svc=";
// This loads all the proxies from the file into an array
$db = DatabaseFactory::getDatabase();
//$proxies = ProxyDAO::getActiveProxies($db);
// Test each of our proxies 10 times
for ($i = 0; $i < 10; $i++) {
    // Reload the proxy list each time through in case we've deactivated something - this will speed up testing.
    $proxies = ProxyDAO::getActiveProxies($db);
    // Here we loop through each cell of the array with the proxies in them testing each one until we get to the end of the array
    foreach ($proxies as $proxy) {
        // Concatenate the proxy string
        $proxy_str = "{$proxy['ip_address']}:{$proxy['port']}";
        // This script utilizes cURL which is library you can read more about
        //using curl in my intro tutorials
        // starting curl and setting the page to get
        $ch = curl_init($testpage);
        // sets the proxy to go through
        curl_setopt($ch, CURLOPT_PROXY, $proxy_str);
        if ($proxy['type'] == 'SOCKS') {
            curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
        }
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
        curl_setopt($ch, CURLOPT_TIMEOUT, 10);
开发者ID:scornfield,项目名称:won-data-extractor,代码行数:31,代码来源:test_proxies.php


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