本文整理匯總了PHP中Gdn_Controller::getStatusMessage方法的典型用法代碼示例。如果您正苦於以下問題:PHP Gdn_Controller::getStatusMessage方法的具體用法?PHP Gdn_Controller::getStatusMessage怎麽用?PHP Gdn_Controller::getStatusMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Gdn_Controller
的用法示例。
在下文中一共展示了Gdn_Controller::getStatusMessage方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: t
echo $this->data('Title', t('Whoops!'));
?>
</h1>
<div id="Message">
<?php
echo Gdn_Format::markdown($this->sanitize($this->data('Exception', 'No error message supplied.')));
?>
</div>
</div>
<?php
if (debug() && $this->data('Trace')) {
?>
<h2>Error</h2>
<?php
echo $this->data('Code') . ' ' . htmlspecialchars(Gdn_Controller::getStatusMessage($this->data('Code')));
?>
<h2>Trace</h2>
<pre stye="text-align"><?php
echo htmlspecialchars($this->data('Trace'));
?>
</pre>
<?php
}
?>
<!-- Code: <?php
$this->data('Code', 400);
?>
-->
</div>
示例2: Gdn_ExceptionHandler
/**
* A custom error handler that displays much more, very useful information when
* errors are encountered in Garden.
*
* @param Exception $Exception The exception that was thrown.
*/
function Gdn_ExceptionHandler($Exception)
{
try {
$ErrorNumber = $Exception->getCode();
$Message = $Exception->getMessage();
$File = $Exception->getFile();
$Line = $Exception->getLine();
if (method_exists($Exception, 'getContext')) {
$Arguments = $Exception->getContext();
} else {
$Arguments = '';
}
$Backtrace = $Exception->getTrace();
// Clean the output buffer in case an error was encountered in-page.
@ob_end_clean();
// prevent headers already sent error
if (!headers_sent()) {
if ($ErrorNumber >= 100 && $ErrorNumber < 600) {
$Code = $ErrorNumber;
} else {
$Code = 500;
}
if (class_exists('Gdn_Controller', false)) {
$msg = Gdn_Controller::getStatusMessage($Code);
} else {
$msg = 'Error';
}
safeHeader("HTTP/1.0 {$Code} {$msg}", true, $ErrorNumber);
safeHeader('Content-Type: text/html; charset=utf-8');
}
$SenderMessage = $Message;
$SenderObject = 'PHP';
$SenderMethod = 'Gdn_ErrorHandler';
$SenderCode = false;
$SenderTrace = $Backtrace;
$MessageInfo = explode('|', $Message);
$MessageCount = count($MessageInfo);
if ($MessageCount == 4) {
list($SenderMessage, $SenderObject, $SenderMethod, $SenderCode) = $MessageInfo;
} elseif ($MessageCount == 3) {
list($SenderMessage, $SenderObject, $SenderMethod) = $MessageInfo;
} elseif (function_exists('GetValueR')) {
$IsError = GetValueR('0.function', $SenderTrace) == 'Gdn_ErrorHandler';
// not exception
$N = $IsError ? '1' : '0';
$SenderMethod = GetValueR($N . '.function', $SenderTrace, $SenderMethod);
$SenderObject = GetValueR($N . '.class', $SenderTrace, $SenderObject);
}
$SenderMessage = htmlspecialchars($SenderMessage);
$Master = false;
// The parsed master view
$CssPath = false;
// The web-path to the css file
$ErrorLines = false;
// The lines near the error's line #
$DeliveryType = defined('DELIVERY_TYPE_ALL') ? DELIVERY_TYPE_ALL : 'ALL';
if (array_key_exists('DeliveryType', $_POST)) {
$DeliveryType = $_POST['DeliveryType'];
} elseif (array_key_exists('DeliveryType', $_GET)) {
$DeliveryType = $_GET['DeliveryType'];
}
if (function_exists('debug') && debug()) {
$Debug = true;
} else {
$Debug = false;
}
// Make sure all of the required custom functions and variables are defined.
$PanicError = false;
// Should we just dump a message and forget about the master view?
if (!defined('DS')) {
$PanicError = true;
}
if (!defined('PATH_ROOT')) {
$PanicError = true;
}
if (!defined('APPLICATION')) {
define('APPLICATION', 'Garden');
}
if (!defined('APPLICATION_VERSION')) {
define('APPLICATION_VERSION', 'Unknown');
}
$WebRoot = '';
// Try and rollback a database transaction.
if (class_exists('Gdn', false)) {
$Database = Gdn::database();
if (is_object($Database)) {
$Database->rollbackTransaction();
}
}
if ($PanicError === false) {
// See if we can get the file that caused the error
if (is_string($File) && is_numeric($ErrorNumber)) {
$ErrorLines = @file($File);
}
//.........這裏部分代碼省略.........