本文整理汇总了PHP中wpdb::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP wpdb::__construct方法的具体用法?PHP wpdb::__construct怎么用?PHP wpdb::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wpdb
的用法示例。
在下文中一共展示了wpdb::__construct方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
/**
* Class constructor
*/
function __construct($dbuser, $dbpassword, $dbname, $dbhost)
{
foreach ($this->qm_php_vars as $setting => &$val) {
$val = ini_get($setting);
}
parent::__construct($dbuser, $dbpassword, $dbname, $dbhost);
}
示例2: __construct
/**
* Create an instance of WPDKDB class
*
* @brief Construct
*
* @return WPDKDB
*/
public function __construct()
{
// Extends WordPress Database class
parent::__construct(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
/*
* Remake check for MySQLi extension because WordPress keep this flag as private.
*
* Use ext/mysqli if it exists and:
*
* - WP_USE_EXT_MYSQL is defined as false, or
* - We are a development version of WordPress, or
* - We are running PHP 5.5 or greater, or
* - ext/mysql is not loaded.
*/
if (function_exists('mysqli_connect')) {
if (defined('WP_USE_EXT_MYSQL')) {
$this->mysqli = !WP_USE_EXT_MYSQL;
} elseif (version_compare(phpversion(), '5.5', '>=') || !function_exists('mysql_connect')) {
$this->mysqli = true;
} elseif (false !== strpos($GLOBALS['wp_version'], '-')) {
$this->mysqli = true;
}
}
// Raise the memory limit and max_execution time
@ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
@set_time_limit(0);
}
示例3:
/**
* PHP5 constructor
*
* @param string $dbuser
* @param string $dbpassword
* @param string $dbname
* @param string $dbhost
*/
function __construct($dbuser, $dbpassword, $dbname, $dbhost)
{
require_once W3TC_LIB_W3_DIR . '/Config.php';
$this->_config =& W3_Config::instance();
$this->_lifetime = $this->_config->get_integer('dbcache.lifetime');
if ($this->_config->get_boolean('dbcache.enabled') && $this->_config->get_boolean('dbcache.debug')) {
ob_start(array(&$this, 'ob_callback'));
}
parent::__construct($dbuser, $dbpassword, $dbname, $dbhost);
}
示例4:
/**
* Connects to the database server and selects a database
*
* PHP5 style constructor for compatibility with PHP5. Does
* the actual setting up of the class properties and connection
* to the database.
*
* @link http://core.trac.wordpress.org/ticket/3354
* @since 2.0.8
*
* @param string $dbuser MySQL database user
* @param string $dbpassword MySQL database password
* @param string $dbname MySQL database name
* @param string $dbhost MySQL database host
*/
function __construct($dbuser, $dbpassword, $dbname, $dbhost)
{
if (!extension_loaded('mysqli')) {
$this->bail('
<h1>Extension Not Loaded</h1>
<p>The mysqli PHP extension is not loaded properly or available for PHP to use.</p>
<ul>
<li>Check your phpinfo</li>
<li>Make sure it is loaded in your php ini file</li>
<li>Turn on display_errors and display_startup_errors so you can detect issues with loading the module.</li>
</ul>');
return;
}
parent::__construct($dbuser, $dbpassword, $dbname, $dbhost);
}
示例5: array
/**
* @see wpdb::__construct()
* @param string $dbuser
* @param string $dbpassword
* @param string $dbname
* @param string $dbhost
*/
function __construct($dbuser, $dbpassword, $dbname, $dbhost)
{
parent::__construct($dbuser, $dbpassword, $dbname, $dbhost);
// these will be whitelisted for both read and write operations
$ignore_both = array('_comment', '_cron', '_cache', '_count', "'cron'", '_edit_lock', '_nonce', '_logins', '_random_seed', '_stats');
self::$CACHE_READ_WHITELIST = $ignore_both;
self::$CACHE_WRITE_WHITELIST = $ignore_both;
// read-only ignore list for things like random numbers and such that have no directly related insert/update statement
array_push(self::$CACHE_READ_WHITELIST, 'FOUND_ROWS', 'RAND()');
// merge in any user-defined keywords
if (defined('CACHE_READ_WHITELIST') && CACHE_READ_WHITELIST) {
self::$CACHE_READ_WHITELIST = array_merge(self::$CACHE_READ_WHITELIST, explode('|', CACHE_READ_WHITELIST));
}
// merge in any user-defined keywords
if (defined('CACHE_WRITE_WHITELIST') && CACHE_WRITE_WHITELIST) {
self::$CACHE_WRITE_WHITELIST = array_merge(self::$CACHE_WRITE_WHITELIST, explode('|', CACHE_WRITE_WHITELIST));
}
}
示例6:
function __construct()
{
parent::__construct('root', '', 'opusx', 'localhost');
}
示例7: __construct
public function __construct($host, $user, $pass, $db)
{
parent::__construct($host, $user, $pass, $db);
}