本文整理汇总了PHP中Error::errorPage方法的典型用法代码示例。如果您正苦于以下问题:PHP Error::errorPage方法的具体用法?PHP Error::errorPage怎么用?PHP Error::errorPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Error
的用法示例。
在下文中一共展示了Error::errorPage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render()
{
// If not defined, assume the most secure bet
if (defined('DISPLAY_ERRORS') && DISPLAY_ERRORS) {
return parent::render();
} else {
return \Error::errorPage($this->code);
}
}
示例2: render
public function render()
{
if (defined('DISPLAY_ERRORS') && DISPLAY_ERRORS) {
http_response_code($this->data['error']['code']);
echo json_encode($this->data);
exit;
} else {
\Error::errorPage($this->data->error->code);
}
}
示例3: render
public function render()
{
if (defined('DISPLAY_ERRORS') && DISPLAY_ERRORS) {
http_response_code($this->data['error']['code']);
$error = $this->data['error'];
$this->displayError($error);
exit;
} else {
\Error::errorPage($this->data->error->code);
}
}
示例4: download
public function download($document_id)
{
require_once 'HTTP/Download.php';
PHPWS_Core::initModClass('filecabinet', 'Document.php');
$document = new PHPWS_Document($document_id);
if (empty($document->id)) {
$message = 'Document id:' . $document_id;
if (!empty($_SERVER['HTTP_REFERER'])) {
$message .= ' request from ' . $_SERVER['HTTP_REFERER'];
}
PHPWS_Error::log(FC_DOCUMENT_NOT_FOUND, 'filecabinet', 'Cabinet_Action::download', $message);
Error::errorPage('404');
}
$folder = new Folder($document->folder_id);
if (!$folder->allow()) {
$content = dgettext('filecabinet', 'Sorry, the file you requested is off limits.');
Layout::add($content);
return;
}
$file_path = $document->getPath();
if (!is_file($file_path)) {
$message = $file_path;
if (!empty($_SERVER['HTTP_REFERER'])) {
$message .= ' request from ' . $_SERVER['HTTP_REFERER'];
}
PHPWS_Error::log(FC_DOCUMENT_NOT_FOUND, 'filecabinet', 'Cabinet_Action::download', $message);
Error::errorPage('404');
}
$file_name = preg_replace('/[^\\w]/', '-', $document->getTitle());
$file_name = preg_replace('/-{2,}/', '-', $file_name);
$file_name = preg_replace('/-$/', '', $file_name);
$file_name .= '.' . $document->getExtension();
$document->downloaded++;
$document->save();
$dl = new HTTP_Download();
$dl->setFile($file_path);
$dl->setCache(true);
$dl->setContentDisposition(HTTP_DOWNLOAD_ATTACHMENT, $file_name);
$dl->setContentType($document->file_type);
$dl->send();
exit;
}
示例5:
<?php
/**
* @author Matthew McNaney <mcnaney at gmail dot com>
* @version $Id$
*/
if (!defined('PHPWS_SOURCE_DIR')) {
Error::errorPage(403);
}
if ($_REQUEST['module'] != 'layout' || !isset($_REQUEST['action'])) {
Error::errorPage('404');
}
if ($_REQUEST['action'] == 'ckeditor') {
Layout::ckeditor();
exit;
}
if (!Current_User::allow('layout')) {
Current_User::disallow();
}
PHPWS_Core::initModClass('layout', 'LayoutAdmin.php');
switch ($_REQUEST['action']) {
case 'admin':
Layout_Admin::admin();
break;
default:
PHPWS_Core::errorPage('404');
}
// END action switch
示例6: denied
public static function denied()
{
Error::errorPage('403');
}