array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'eventhttprequest.senderror.php', 1 => 'EventHttpRequest::sendError', 2 => 'Send an HTML error message to the client', ), 'up' => array ( 0 => 'class.eventhttprequest.php', 1 => 'EventHttpRequest', ), 'prev' => array ( 0 => 'eventhttprequest.removeheader.php', 1 => 'EventHttpRequest::removeHeader', ), 'next' => array ( 0 => 'eventhttprequest.sendreply.php', 1 => 'EventHttpRequest::sendReply', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/event/eventhttprequest/senderror.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

EventHttpRequest::sendError

(PECL event >= 1.4.0-beta)

EventHttpRequest::sendErrorSend an HTML error message to the client

Опис

public EventHttpRequest::sendError( int $error , string $reason = null ): void

Send an HTML error message to the client.

Параметри

error

The HTTP error code.

reason

A brief explanation ofthe error. If null, the standard meaning of the error code will be used.

Значення, що повертаються

Не повертає значень.

Приклади

Приклад #1 EventHttpRequest::sendError() example

<?php
function _http_400($req) {
$req->sendError(400);
}

$base = new EventBase();
$http = new EventHttp($base);

$http->setCallback("/err400", "_http_400");

$http->bind("0.0.0.0", 8010);
$base->loop();
?>

Прогляньте також