PHPのtrigger_error()関数
例
$ usernum> 10の場合、エラーをトリガーします。
<?php
if ($usernum>10) {
trigger_error("Number cannot be larger than 10");
}
?>
定義と使用法
trigger_error()関数は、ユーザーレベルのエラーメッセージを作成します。
trigger_error()関数は、組み込みのエラーハンドラー、または set_error_handler()関数によって設定されたユーザー定義関数で使用できます。
構文
trigger_error(message, type)
パラメータ値
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:
|
技術的な詳細
戻り値: | 間違ったエラータイプが指定されている場合はFALSE、それ以外の場合はTRUE |
---|---|
PHPバージョン: | 4.0.1+ |
PHPエラーリファレンス