PHP trigger_error() 函数
PHP 教程
· 2019-01-24 16:28:00
定义和用法
trigger_error() 函数创建用户自定义的错误消息。
trigger_error() 函数用于在用户指定的条件下触发一个错误消息。它可以与内建的错误处理程序一起使用,或者与由 set_error_handler() 函数设置的用户自定义函数一起使用。
当您需要在运行脚本时的某个指定条件下自定义错误消息时,该函数很有用。
如果指定了一个不合法的错误类型,该函数返回 FALSE,否则返回 TRUE。
语法
trigger_error(error_message,error_types)
| 参数 | 描述 |
|---|---|
| error_message | 必需。规定错误消息。长度限制为 1024 个字符。 |
| error_types | 可选。规定错误消息的错误类型。 可能的错误类型:
|
实例
<?php
$test=2;
if ($test>1)
{
trigger_error("A custom error has been triggered");
}
?>
上面代码的输出如下所示:
Notice: A custom error has been triggered in C:webfoldertest.php on line 6
点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html
Approximation Algorithms
Vijay V. Vazirani / Springer / 2001-07-02 / USD 54.95
'This book covers the dominant theoretical approaches to the approximate solution of hard combinatorial optimization and enumeration problems. It contains elegant combinatorial theory, useful and inte......一起来看看 《Approximation Algorithms》 这本书的介绍吧!