本文整理汇总了PHP中JError::translateErrorLevel方法的典型用法代码示例。如果您正苦于以下问题:PHP JError::translateErrorLevel方法的具体用法?PHP JError::translateErrorLevel怎么用?PHP JError::translateErrorLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JError
的用法示例。
在下文中一共展示了JError::translateErrorLevel方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: raiseError
/**
* Format a JError object as a JSON string
*/
public function raiseError($error)
{
$data = array();
$data[] = JError::translateErrorLevel($error->get('level')) . ' ' . $error->get('code') . ': ';
if ($error->get('message')) {
$data[] = $error->get('message');
}
if ($error->get('code') >= 500) {
if ($error->get('line')) {
$data[] = ' IN LINE ' . $error->get('line');
}
if ($error->get('function')) {
$text = ' IN ';
if ($error->get('class')) {
$text = $error->get('class') . '::';
}
$text = $error->get('function');
$data[] = $text;
}
if ($error->get('file')) {
$data[] = 'IN FILE ' . $error->get('file');
}
}
header('Content-Type: text/json');
header('Content-Encoding: UTF-8');
$output = array('result' => '', 'error' => true, 'code' => $error->get('code'), 'text' => $data);
exit(json_encode($output));
}
示例2: raiseError
/**
* Format a JError object as a JSON string
*/
public static function raiseError($error)
{
$data = array();
$data[] = JError::translateErrorLevel($error->get('level')) . ' ' . $error->get('code') . ': ';
if ($error->get('message')) {
$data[] = $error->get('message');
}
$output = array('result' => '', 'error' => true, 'code' => $error->get('code'), 'text' => $data);
header('Content-Type: text/json');
header('Content-Encoding: UTF-8');
exit(json_encode($output));
}
示例3: handleDie
/**
* Die error handler
* - Echos the error message to output and then dies
*
* @param object &$error Exception object to handle
* @param array $options Handler options
*
* @return object The exception object
*
* @deprecated 12.1
* @see raise()
* @since 11.1
*/
public static function handleDie(&$error, $options)
{
// Deprecation warning.
JLog::add('JError::handleDie() is deprecated.', JLog::WARNING, 'deprecated');
$level_human = JError::translateErrorLevel($error->get('level'));
if (isset($_SERVER['HTTP_HOST'])) {
// Output as html
jexit("<br /><b>J{$level_human}</b>: " . $error->get('message') . "<br />\n");
} else {
// Output as simple text
if (defined('STDERR')) {
fwrite(STDERR, "J{$level_human}: " . $error->get('message') . "\n");
jexit();
} else {
jexit("J{$level_human}: " . $error->get('message') . "\n");
}
}
return $error;
}
示例4: die
/**
* Die error handler
* - Echos the error message to output and then dies
*
* @static
* @param object $error Exception object to handle
* @param array $options Handler options
* @return object The exception object
* @since 1.5
*
* @see raise()
*/
function &handleDie(&$error, $options)
{
$level_human = JError::translateErrorLevel($error->get('level'));
if (isset($_SERVER['HTTP_HOST'])) {
// output as html
die("<br /><b>J{$level_human}</b> " . $error->get('message') . "<br />\n");
} else {
// output as simple text
if (defined('STDERR')) {
fwrite(STDERR, "J{$level_human} " . $error->get('message') . "\n");
} else {
die("J{$level_human} " . $error->get('message') . "\n");
}
}
return $error;
}
示例5: raiseError
function raiseError($error)
{
$output = array();
$output[] = JError::translateErrorLevel($error->get('level')) . ' ' . $error->get('code') . ': ';
if ($error->get('message')) {
$output[] = $error->get('message');
}
if ($error->get('line')) {
$output[] = ' IN LINE ' . $error->get('line');
}
if ($error->get('function')) {
$text = ' IN ';
if ($error->get('class')) {
$text = $error->get('class') . '::';
}
$text = $error->get('function');
$output[] = $text;
}
if ($error->get('file')) {
$output[] = 'IN FILE ' . $error->get('file');
}
exit($this->json_encode(array('result' => '', 'error' => implode("\n", $output))));
}