Cakephp 记录当前文件名
是否有方法记录调用Cakephp 记录当前文件名,cakephp,Cakephp,是否有方法记录调用$this->log的文件名/类名/函数和/或行号 我在$this->log或CakeLog::write()的文档中找不到这一点。是的,您可以为此使用默认的PHP常量。例如: CakeLog::write('debug', 'Oops, something went wrong in ' . __FILE__ . ' on line' . __LINE__ . ' within the class ' . get_class() ); 这将为您提供所需的所有信息。是
$this->log
的文件名/类名/函数和/或行号
我在
$this->log
或CakeLog::write()
的文档中找不到这一点。是的,您可以为此使用默认的PHP常量。例如:
CakeLog::write('debug', 'Oops, something went wrong in ' .
__FILE__ . ' on line' . __LINE__ . ' within the class ' . get_class()
);
这将为您提供所需的所有信息。是的,您可以为此使用默认的PHP常量。例如:
CakeLog::write('debug', 'Oops, something went wrong in ' .
__FILE__ . ' on line' . __LINE__ . ' within the class ' . get_class()
);
这将为您提供所需的所有信息。或者更方便,只需记录跟踪:
$e = new Exception; $this->log($e->getTraceAsString());
将使用导致特定log()语句的文件和行号记录您的调用。或者更方便,只需记录跟踪:
$e = new Exception; $this->log($e->getTraceAsString());
将使用导致特定log()语句的文件和行号记录您的呼叫。谢谢。将上述语法借用成$this->log格式$此->日志('Oops,在'.\uu文件'.'on line'.line.'中出现了一些错误。'in the class'.get\u class(),'debug')@Joe Smith您还可以为此编写一个新函数并使用。当您要记录大量的
\uuuuu文件\uuuu
/\uuuu行\uuuu
消息时,这可能会很有用。谢谢。将上述语法借用成$this->log格式$此->日志('Oops,在'.\uu文件'.'on line'.line.'中出现了一些错误。'in the class'.get\u class(),'debug')@Joe Smith您还可以为此编写一个新函数并使用。当您要记录大量的\uuuuuu文件\uuuuuu
/\uuuuu行\uuuuu
消息时,这可能很有用。