PHPチュートリアル

PHPホーム PHPイントロ PHPインストール PHP構文 PHPコメント PHP変数 PHPエコー/印刷 PHPデータ型 PHP文字列 PHP番号 PHP数学 PHP定数 PHP演算子 PHP If ... Else ... Elseif PHPスイッチ PHPループ PHP関数 PHP配列 PHPスーパーグローバル PHP正規表現

PHPフォーム

PHPフォーム処理 PHPフォームの検証 PHPフォームが必要 PHPフォームのURL / Eメール PHPフォームの完了

PHP Advanced

PHPの日付と時刻 PHPインクルード PHPファイルの処理 PHPファイルのオープン/読み取り PHPファイルの作成/書き込み PHPファイルのアップロード PHPクッキー PHPセッション PHPフィルター PHPフィルターアドバンスト PHPコールバック関数 PHP JSON PHPの例外

PHPOOP _

PHPOOPとは PHPクラス/オブジェクト PHPコンストラクター PHPデストラクタ PHPアクセス修飾子 PHPの継承 PHP定数 PHP抽象クラス PHPインターフェース PHPの特性 PHP静的メソッド PHPの静的プロパティ PHP名前空間 PHPIterables

MySQLデータベース

MySQLデータベース MySQLコネクト MySQL Create DB MySQLテーブルの作成 MySQLの挿入データ MySQLは最後のIDを取得します MySQL Insert Multiple MySQLを準備しました MySQL Select Data MySQL Where MySQL Order By MySQLデータの削除 MySQLアップデートデータ MySQL制限データ

PHP XML

PHPXMLパーサー PHPSimpleXMLパーサー PHPSimpleXML-取得 PHP XMLExpat PHP XML DOM

PHP -AJAX

AJAXイントロ AJAX PHP AJAXデータベース AJAX XML AJAXライブ検索 AJAXポール

PHPの

PHPの例 PHPコンパイラ PHPクイズ PHP演習 PHP証明書

PHPリファレンス

PHPの概要 PHP配列 PHPカレンダー PHPの日付 PHPディレクトリ PHPエラー PHP例外 PHPファイルシステム PHPフィルター PHP FTP PHP JSON PHPキーワード PHP Libxml PHPメール PHP数学 PHPその他 PHP MySQLi PHPネットワーク PHP出力制御 PHP正規表現 PHP SimpleXML PHPストリーム PHP文字列 PHP変数の処理 PHPXMLパーサー PHP Zip PHPタイムゾーン

PHP error_log()関数

PHPエラーリファレンス

エラーメッセージをWebサーバーのエラーログとメールアカウントに送信します。

<?php
// Send error message to the server log if error connecting to the database
if (!mysqli_connect("localhost","bad_user","bad_password","my_db")) {
    error_log("Failed to connect to database!", 0);
}

// Send email to administrator if we run out of FOO
if (!($foo = allocate_new_foo())) {
    error_log("Oh no! We are out of FOOs!", 1, "[email protected]");
}
?>


定義と使用法

error_log()関数は、エラーメッセージをログ、ファイル、またはメールアカウントに送信します。


構文

error_log(message, type, destination, headers);

パラメータ値

Parameter Description
message Required. Specifies the error message to log
type Optional. Specifies where the error message should go. Possible values:
  • 0 - Default. Message is sent to PHP's system logger, using the OS' system logging mechanism or a file, depending on what the error_log configuration is set to in php.ini
  • 1 - Message is sent by email to the address in the destination parameter
  • 2 - No longer in use (only available in PHP 3)
  • 3 - Message is appended to the file specified in destination
  • 4 - Message is sent directly to the SAPI logging handler
destination Optional. Specifies the destination of the error message. This value depends on the value of the type parameter
headers Optional. Only used if the type parameter is set to 1. Specifies additional headers, like From, Cc, and Bcc. Multiple headers should be separated with a CRLF (\r\n)


技術的な詳細

戻り値: 成功するとTRUE。失敗するとFALSE
PHPバージョン: 4.0以降
バイナリセーフ: 番号
PHP変更ログ: PHP 5.2.7:4の値がtypeパラメーターに追加されました

PHPエラーリファレンス