PHP - error_log() 函数



语法

bool error_log ( string $message [, int $message_type [, string $destination [, string $extra_headers]]] )

定义和用法

它将错误消息发送到 Web 服务器的错误日志、TCP 端口或文件。

参数

序号 参数和描述
1

message

要记录的错误消息。

2

message_type

它指定错误消息的发送位置。可能的 message_type 如下:

  • 0 - 默认值。错误消息发送到服务器的日志系统或文件,取决于 php.ini 文件中 error_log 配置的设置。

  • 1 - 错误消息通过电子邮件发送到 destination 参数指定的地址。此 message_type 是唯一使用 headers 参数的类型。

  • 2 - 错误消息通过 PHP 调试连接发送。此选项仅在 PHP 3 中可用。

  • 3 - 错误消息添加到文件 destination 字符串中。

3

destination

目标位置。其含义取决于 message_type 参数,如上所述。

4

extra_headers

额外的报头。当 message_type 参数设置为 1 时使用。此 message_type 使用与 mail() 函数相同的内部函数。

返回值

成功返回 TRUE,失败返回 FALSE。

php_function_reference.htm
广告
© . All rights reserved.