本文整理匯總了PHP中Debugger::HandleException方法的典型用法代碼示例。如果您正苦於以下問題:PHP Debugger::HandleException方法的具體用法?PHP Debugger::HandleException怎麽用?PHP Debugger::HandleException使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Debugger
的用法示例。
在下文中一共展示了Debugger::HandleException方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getInstance
public static function getInstance()
{
if (isset(self::$conn) && self::$conn) {
return self::$conn;
} else {
try {
self::$conn = new PDO('mysql:host=' . config::$DB_SERVER . ';dbname=' . config::$DB_NAME . ';charset=UTF8', config::$DB_USER, config::$DB_PASSWORD, array(PDO::ATTR_PERSISTENT => true));
//Use persistent connection, since the search mechanism causes numerious concurrent and subsequent requests to the db
self::$conn->exec("SET NAMES utf8");
// Tell the db that we use utf-8
self::$conn->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
//for heavy traffic optimization
self::$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
self::$conn->setAttribute(PDO::ATTR_PERSISTENT, true);
//Use persistent connection, since the search mechanism causes numerious concurrent and subsequent requests to the db
return self::$conn;
} catch (PDOException $e) {
Debugger::HandleException($e);
}
}
}
示例2: exec
public function exec($sql)
{
try {
$conn = self::getInstance();
$conn->exec($sql);
} catch (PDOException $e) {
echo $query;
Debugger::HandleException($e, $sql);
}
}