本文整理汇总了PHP中DatabaseManager::connect方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseManager::connect方法的具体用法?PHP DatabaseManager::connect怎么用?PHP DatabaseManager::connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseManager
的用法示例。
在下文中一共展示了DatabaseManager::connect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Construct a new database object.
* @param $settings
*/
public function __construct($settings)
{
$this->database = DatabaseManager::connect($settings["host"], $settings["port"], $settings["user"], $settings["pass"], $settings["name"], isset($settings["utf8"]) ? $settings["utf8"] : true);
// Debug
global $settings;
R::debug($settings["development"]);
}
示例2: __construct
/**
* Constructor function to initiate the object of this class.
* @param Array $config
*/
public function __construct($config)
{
$this->dbConfig = $config;
//store the config file.
//Make a connection to the DB. DB Credentials are provided inside the configuration file.
DatabaseManager::connect(new DatabaseConfig($config['ADAPTER'], $config['DBNAME'], $config['USERNAME'], $config['PASSWORD']));
//create a new Db handler.
}
示例3: DatabaseConfig
<?php
namespace phpsec;
/**
* Required Files
*/
require_once __DIR__ . "/../../libs/db/dbmanager.php";
try {
$config = (include __DIR__ . "/../../libs/config.php");
$dbname = $config['DBNAME'];
$username = $config['DBUSER'];
$password = $config['DBPASS'];
DatabaseManager::connect(new DatabaseConfig('pdo_mysql', $dbname, $username, $password, "127.0.0.1"));
//create a new Db handler.
} catch (\Exception $e) {
echo $e->getMessage();
}
示例4: sanitize_output
function sanitize_output($buffer)
{
$search = array('/\\>[^\\S ]+/s', '/[^\\S ]+\\</s', '/(\\s)+/s');
$replace = array('>', '<', '\\1');
$buffer = preg_replace($search, $replace, $buffer);
return $buffer;
}
/** $Init the initiator class */
$Init = new Initiator();
/** Starts the init itself */
$Init::startInit();
/** $FOGFTP the FOGFTP class */
$FOGFTP = new FOGFTP();
/** $FOGCore the FOGCore class */
$FOGCore = new FOGCore();
/** $DatabaseManager the DatabaseManager class */
$DatabaseManager = new DatabaseManager();
/** $DB set's the DB class from the DatabaseManager */
$DB = $FOGCore->DB = $DatabaseManager->connect()->DB;
/** Loads any Session variables */
$FOGCore->setSessionEnv();
/** $TimeZone the timezone setter */
$TimeZone = $FOGCore->TimeZone = $_SESSION['TimeZone'];
/** $EventManager initiates the EventManager class */
$FOGCore->EventManager = $EventManager = $FOGCore->getClass('EventManager');
/** $HookManager initiates the HookManager class */
$FOGCore->HookManager = $HookManager = $FOGCore->getClass('HookManager');
$HookManager->load();
$EventManager->load();
/** $HookManager initiates the FOGURLRequest class */
$FOGCore->FOGURLRequests = $FOGURLRequests = $FOGCore->getClass('FOGURLRequests');