當前位置: 首頁>>代碼示例>>PHP>>正文


PHP utility::loadSettings方法代碼示例

本文整理匯總了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);
開發者ID:purwoko,項目名稱:s3st15_matoa,代碼行數:30,代碼來源:sysconfig.inc.php


注:本文中的utility::loadSettings方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。