我@$this->dom->loadHTML($page);
用来抑制错误,但 CodeIgniter 似乎不尊重这一点......
日志中返回一系列错误
错误 - 2012-07-17 16:36:27 --> 严重性:警告 --> DOMDocument::loadHTML():
有没有办法只为一段代码或功能禁用日志记录?
我@$this->dom->loadHTML($page);
用来抑制错误,但 CodeIgniter 似乎不尊重这一点......
日志中返回一系列错误
错误 - 2012-07-17 16:36:27 --> 严重性:警告 --> DOMDocument::loadHTML():
有没有办法只为一段代码或功能禁用日志记录?
这与“尊重”无关@
,它与您误解@
CI 的作用以及与它的关系有关。
@
函数前面的符号告诉 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;