Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/247.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何向OpenCart错误日志添加注释?_Php_Opencart_Opencart2.x - Fatal编程技术网

Php 如何向OpenCart错误日志添加注释?

Php 如何向OpenCart错误日志添加注释?,php,opencart,opencart2.x,Php,Opencart,Opencart2.x,在Laravel中,我可以使用log()命令向日志文件添加注释(这有助于我进行调试),如下所示: $var = 'this is a variable'; //some other code goes here log::('Is $var a null? Here is the value '.$var); 然后我可以签入日志文件 如何在OpenCart中执行此操作?在OpenCart 2和3中,在/system/library/log.php中有日志库 该库几乎可以从任何地方(从任何模型和

在Laravel中,我可以使用
log()
命令向日志文件添加注释(这有助于我进行调试),如下所示:

$var = 'this is a variable';
//some other code goes here
log::('Is $var a null? Here is the value '.$var);
然后我可以签入日志文件


如何在OpenCart中执行此操作?

在OpenCart 2和3中,在/system/library/log.php中有日志库

该库几乎可以从任何地方(从任何模型和控制器)访问。您可以像这样轻松地使用它:

$var = 'this is a variable';
//some other code goes here
$this->log->write('Is $var a null? Here is the value '.$var);
可以在/system/storage/logs/error.Log中找到日志文件


另一种方式

$var = 'this is a variable';
//some other code goes here
$log = new Log('LOG_NAME.log');
$log->write('Is $var a null? Here is the value '.$var);
您将在/system/storage/logs中找到日志文件/