Funkce PHP trigger_error() .
Příklad
Pokud $usernum > 10, spustí chybu:
<?php
if ($usernum>10) {
trigger_error("Number cannot be larger than 10");
}
?>
Definice a použití
Funkce trigger_error() vytvoří chybovou zprávu na úrovni uživatele.
Funkci trigger_error() lze použít s vestavěnou obslužnou rutinou chyb nebo s uživatelsky definovanou funkcí nastavenou funkcí set_error_handler() .
Syntax
trigger_error(message, type)
Hodnoty parametrů
Parameter | Description |
---|---|
message | Required. Specifies the error message for this error. Max 1024 bytes in length |
type | Optional. Specifies the error type for this error. Possible values:
|
Technické údaje
Návratová hodnota: | FALSE, pokud je zadán nesprávný typ chyby, TRUE v opačném případě |
---|---|
Verze PHP: | 4.0.1+ |
Odkaz na chyby PHP