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


PHP JError::translateErrorLevel方法代碼示例

本文整理匯總了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));
 }
開發者ID:andreassetiawanhartanto,項目名稱:PDKKI,代碼行數:31,代碼來源:utility.php

示例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));
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:15,代碼來源:request.php

示例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;
 }
開發者ID:NavaINT1876,項目名稱:ccustoms,代碼行數:32,代碼來源:error.php

示例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;
 }
開發者ID:Fellah,項目名稱:govnobaki,代碼行數:28,代碼來源:error.php

示例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))));
 }
開發者ID:rlee1962,項目名稱:diylegalcenter,代碼行數:23,代碼來源:plugin.php


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