探索小程序使用 MD5 的方式与技巧
698
2022-10-25
CodeIgniter 打开错误日志
app/config/config.php
/* |--------------------------------------------------------------------------| 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'] = 4;
默认0 不输出log, 4等级最高
app/logs/log-2022-07-29.php
输出日志用\log_message函数
log_message('error', "Unable to write cache file: ".$cache_path);
system/core/Common.php
system/libraries/Log.php
/** * Write Log File * * Generally this function will be called using the global log_message() function * * @param string the error level * @param string the error message * @param bool whether the error is a native PHP error * @return bool */ public function write_log($level = 'error', $msg, $php_error = FALSE) { if ($this->_enabled === FALSE) { return FALSE; } $level = strtoupper($level); if ( ! isset($this->_levels[$level]) OR ($this->_levels[$level] > $this->_threshold)) { return FALSE; } $filepath = $this->_log_path.'log-'.date('Y-m-d').'.php'; $message = ''; if ( ! file_exists($filepath)) { $message .= "<"."?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?".">\n\n"; } if ( ! $fp = @fopen($filepath, FOPEN_WRITE_CREATE)) { return FALSE; } $message .= $level.' '.(($level == 'INFO') ? ' -' : '-').' '.date($this->_date_fmt). ' --> '.$msg."\n"; flock($fp, LOCK_EX); fwrite($fp, $message); flock($fp, LOCK_UN); fclose($fp); @chmod($filepath, FILE_WRITE_MODE); return TRUE; }
CodeIgniter phpstorm自动补全
@property \CI_Input input
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~