0

私は@$this->dom->loadHTML($page);エラーを抑制するために使用していますが、CodeIgniterはそれを尊重していないようです...

一連のエラーがログに返されます

エラー-2012-07-1716:36:27->重大度:警告-> DOMDocument :: loadHTML():

コードまたは関数の一部に対してのみログを無効にする方法はありますか?

4

1 に答える 1

1

これは、 を「尊重する」こととは何の関係もありません。それは、CI が何を行い、どのように CI に結びついているか@を誤解していることと関係があります。@

関数の前の@記号 in= は、PHP (CI ではない) に次のように指示します。

PHP で式の先頭に追加すると、その式によって生成される可能性のあるエラー メッセージは無視されます。

参考: http: //us3.php.net/manual/en/language.operators.errorcontrol.php

これが基本的に意味することは、エラーを「ジャンプ」することです (そうしないと、エラーで実行が中断されます)。CI は、そのように構成されている場合、引き続きエラーをログに記録します。

CI の構成を編集し、ログ レベルを定義する必要があります。

/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| If you have enabled error logging, you can set an error threshold to
| determine what gets logged. Threshold options are:
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
|   0 = Disables logging, Error logging TURNED OFF
|   1 = Error Messages (including PHP errors)
|   2 = Debug Messages
|   3 = Informational Messages
|   4 = All Messages
|
| For a live site you'll usually only enable Errors (1) to be logged otherwise
| your log files will fill up very fast.
|
*/
$config['log_threshold'] = 1;
于 2012-07-18T03:16:42.053 に答える