本文整理汇总了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);
}
}