本文整理匯總了PHP中utility::loadSettings方法的典型用法代碼示例。如果您正苦於以下問題:PHP utility::loadSettings方法的具體用法?PHP utility::loadSettings怎麽用?PHP utility::loadSettings使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類utility
的用法示例。
在下文中一共展示了utility::loadSettings方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: define
define('DB_PORT', '3306');
// check if database connection constants are undefined
if (!defined('DB_NAME')) {
define('DB_NAME', 'senayandb');
}
if (!defined('DB_USERNAME')) {
define('DB_USERNAME', 'senayanuser');
}
if (!defined('DB_PASSWORD')) {
define('DB_PASSWORD', 'password_senayanuser');
}
// database connection
// we prefer to use mysqli extensions if its available
if (extension_loaded('mysqli')) {
/* MYSQLI */
$dbs = @new mysqli(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME, DB_PORT);
if (mysqli_connect_error()) {
die('<div style="border: 1px dotted #FF0000; color: #FF0000; padding: 5px;">Error Connecting to Database. Please check your configuration</div>');
}
} else {
/* MYSQL */
// require the simbio mysql class
include SIMBIO_BASE_DIR . 'simbio_DB/mysql/simbio_mysql.inc.php';
// make a new connection object that will be used by all applications
$dbs = @new simbio_mysql(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME, DB_PORT);
}
/* Force UTF-8 for MySQL connection */
$dbs->query('SET NAMES \'utf8\'');
// load global settings from database. Uncomment below lines if you dont want to load it
utility::loadSettings($dbs);