本文整理汇总了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);
}
示例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);
示例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);