本文整理汇总了PHP中logger::exception方法的典型用法代码示例。如果您正苦于以下问题:PHP logger::exception方法的具体用法?PHP logger::exception怎么用?PHP logger::exception使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类logger
的用法示例。
在下文中一共展示了logger::exception方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: query
function query($sql, $is_read = true)
{
$result = mysql_query($sql, self::$conn[$this->i]);
$log = config('log', 'mysql');
$log['is_record_sql'] and logger::sql($sql, $is_read);
if ($result) {
return $result;
}
$info = $sql . ' {' . mysql_error() . '}';
$log['is_record_exception'] and logger::exception('mysql', $info);
throw new Exception($info, 104);
}
示例2: __construct
function __construct($message, $code, $error = 0)
{
logger::exception('server', $code . ' : ' . $message);
$this->error = $error;
parent::__construct($message, $code);
}
示例3: socket
static function socket($url, $data)
{
//解析url
if (!is_array($url)) {
$url = parse_url($url);
}
if (!isset($url["port"])) {
$url['port'] = 80;
}
//打开socket
$fp = fsockopen($url['host'], $url['port'], $error_no, $error_info, 30);
if (!$fp) {
$info = 'error:(' . $error_no . ')' . $error_info;
logger::exception('socket', $info);
throw new Exception($info, 107);
}
//组装发送数据
if (is_array($data)) {
$data = http_build_query($data);
}
$data = trim($data);
//构造头部信息
$head = 'POST ' . $url['path'] . " HTTP/1.0\r\n";
$head .= 'Host: ' . $url['host'] . "\r\n";
$head .= 'Referer: http://' . $url['host'] . $url['path'] . "\r\n";
$head .= "Content-type: application/x-www-form-urlencoded\r\n";
$head .= 'Content-Length: ' . strlen($data) . "\r\n\r\n";
$head .= $data;
//接收并返回结果
fputs($fp, $head);
$info = '';
while (!feof($fp)) {
$info = fgets($fp);
}
return json_decode($info, true);
}
示例4: send
static function send($to, $title, $content, $cc = '', $type = 'HTML')
{
$mail = self::get_instance();
$from = config('from', 'mail');
$mail->send_mails($to, $title, $content, $type, $from, $cc);
if (self::$exception) {
logger::exception('mail', implode(PHP_EOL, self::$exception));
}
}
示例5: bootstrap
static function bootstrap($controller, $method)
{
try {
if ($controller && $method) {
define('CURRENT_ACTION', substr($controller . ':' . $method, 2));
if (property_exists($controller, 'static_class')) {
if (method_exists($controller, '__before')) {
call_user_func($controller . '::__before');
}
call_user_func(array($controller, $method), explode('/', URL_REQUEST));
if (method_exists($controller, '__after')) {
call_user_func($controller, '::__after');
}
} else {
$object = new $controller();
if (method_exists($controller, '__before')) {
$object->__before();
}
call_user_func_array(array($object, $method), array(explode('/', URL_REQUEST)));
if (method_exists($controller, '__after')) {
$object->__after();
}
}
} else {
throw new Exception('absent controller or method', 101);
}
} catch (Exception $e) {
logger::exception('exception', $e->getCode() . ' : ' . $e->getMessage());
if (preg_match('/^(similar|product)$/', ENVIRONMENT)) {
if (http::is_ajax()) {
http::json(array('error' => 4, 'message' => $e->getMessage(), 'data' => null));
} else {
http::abort($e->getMessage(), '', 10);
}
}
debug::exception($e);
}
}