ThinkPHP
2018-11-09 本文已影响0人
DaveJ
Thinkphp根据控制器名称保存日志
/**
* 日志写入接口
* @access public
* @param array $log 日志信息
* @return bool
*/
public function save(array $log = [])
{
if ($this->config['single']) {
$name = is_string($this->config['single']) ? $this->config['single'] : 'single';
$destination = $this->config['path'] . $name . '.log';
} else {
//$cli = PHP_SAPI == 'cli' ? '_cli' : '';
/*************************start******************************/
$entity = strtolower(\request()->module());
$cli = PHP_SAPI == 'cli' ? ($entity ? '_'.$entity : '_cli') : '_'.$entity;
/************************** end ****************************/