本文整理汇总了PHP中Log::record方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::record方法的具体用法?PHP Log::record怎么用?PHP Log::record使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Log
的用法示例。
在下文中一共展示了Log::record方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: team
public function team()
{
$this->assign('title', '团队');
$ing_groups = D('BookGroup')->where(['status' => 0])->select();
Log::record(print_r($ing_groups, true));
foreach ($ing_groups as &$ing_g) {
$books = D('Book')->where(['gid' => $ing_g['id']])->order('uid asc,id desc')->select();
foreach ($books as &$book) {
$user = D('User')->where(['id' => $book['uid']])->find();
$book['uname'] = $user['name'];
}
$ing_g['books'] = $books;
}
$ed_groups = D('BookGroup')->where(['status' => 1])->select();
foreach ($ed_groups as &$ed) {
$books = D('Book')->where(['gid' => $ed['id']])->order('uid asc,id desc')->select();
foreach ($books as &$book) {
$user = D('User')->where(['id' => $book['uid']])->find();
$book['uname'] = $user['name'];
}
$ed['books'] = $books;
}
$this->assign('ing_groups', $ing_groups);
$this->assign('ed_groups', $ed_groups);
$this->display('');
}
示例2: showTrace
/**
+----------------------------------------------------------
* 显示页面Trace信息
+----------------------------------------------------------
* @access private
+----------------------------------------------------------
*/
private function showTrace()
{
// 系统默认显示信息
$log = Log::$log;
$files = get_included_files();
$trace = array('请求时间' => date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME']), '当前页面' => __SELF__, '请求协议' => $_SERVER['SERVER_PROTOCOL'] . ' ' . $_SERVER['REQUEST_METHOD'], '运行信息' => $this->showTime(), '会话ID' => session_id(), '日志记录' => !empty($log) ? $log : '无日志记录', '加载文件' => $files);
// 读取项目定义的Trace文件
$traceFile = CONF_PATH . 'trace.php';
if (is_file($traceFile)) {
// 定义格式 return array('当前页面'=>$_SERVER['PHP_SELF'],'通信协议'=>$_SERVER['SERVER_PROTOCOL'],...);
$trace = array_merge(include $traceFile, $trace);
}
// 设置trace信息
trace($trace);
$fire = array(array('', ''));
foreach (trace() as $key => $value) {
$fire[] = array($key, $value);
}
if (headers_sent($filename, $linenum)) {
$fileInfo = !empty($filename) ? "(在{$filename}文件的第{$linenum}行)" : '';
Log::record("已经有Http Header信息头输出{$fileInfo},请在你的入口文件加入ob_start() 或通过配置output_buffering,已确保headers不被提前输出");
} else {
fb(array('页面Trace信息', $fire), FirePHP::TABLE);
}
}
示例3: get_setting
function get_setting()
{
$payconf = M('redcash_wxconf')->where(array('token' => $this->token))->find();
if (!$payconf['mchid'] || !$payconf['appid'] || !$payconf['key']) {
Log::record('get red cash wechat params: ' . print_r($payconf, 1), Log::INFO);
Log::save();
die('微信参数配置不完整');
}
$setting = M('redcash_setting')->where(array('token' => $this->token, 'id' => $this->redcash_id))->find();
$setting['mchid'] = $payconf['mchid'];
$setting['appid'] = $payconf['appid'];
$setting['key'] = $payconf['key'];
if ($setting['status'] == '1') {
$money = intval($setting['fixed_amount'] * 100);
$setting['min_value'] = $money;
$setting['max_value'] = $money;
$setting['total_amount'] = $money;
}
if (!$setting['nick_name'] || !$setting['send_name'] || !$setting['fixed_amount'] || !$setting['wishing'] || !$setting['act_name'] || !$setting['remark']) {
Log::record('get red cash params : ' . print_r($setting, 1), Log::INFO);
Log::save();
die('活动信息配置不完整');
}
$certs = array('SSLCERT' => getcwd() . '/' . $payconf['ssl_cert'], 'SSLKEY' => getcwd() . '/' . $payconf['ssl_key'], 'CAINFO' => getcwd() . '/' . $payconf['ssl_cainfo']);
if (!$certs) {
die('未设置微信支付证书信息');
}
$setting['certs'] = array('certs' => $certs);
return $setting;
}
示例4: model
/**
* 实例化(分层)模型
* @param string $name Model名称
* @param string $layer 业务层名称
* @return Object
*/
public static function model($name = '', $layer = MODEL_LAYER)
{
if (empty($name)) {
return new Model();
}
static $_model = [];
if (isset($_model[$name . $layer])) {
return $_model[$name . $layer];
}
if (strpos($name, '/')) {
list($module, $name) = explode('/', $name, 2);
} else {
$module = MODULE_NAME;
}
$class = self::parseClass($module, $layer, $name);
$name = basename($name);
if (class_exists($class)) {
$model = new $class($name);
} else {
$class = str_replace('\\' . $module . '\\', '\\' . COMMON_MODULE . '\\', $class);
if (class_exists($class)) {
$model = new $class($name);
} else {
Log::record('实例化不存在的类:' . $class, 'notic');
$model = new Model($name);
}
}
$_model[$name . $layer] = $model;
return $model;
}
示例5: send
public static function send($msg, $detail, $level = self::USER, $mobile = null)
{
//判断是否定义需要发送短信
if (!in_array($level, explode(',', C('SMS_LEVEL')))) {
return;
}
//判断发送频率
$mc = memcache_init();
$is_send = $mc->get('think_sms_send');
//如果已经发送,则不发送
if ($is_send === 'true') {
$status = 'not send';
} else {
//TODU,如果apibus类调整,此类也得调整
$sms = apibus::init('sms');
if (is_null($mobile)) {
$mobile = C('SMS_MOBILE');
}
$mc = memcache_init();
$obj = $sms->send($mobile, mb_substr(C('SMS_SIGN') . $msg, 0, 65, 'utf-8'), "UTF-8");
if ($sms->isError($obj)) {
$status = 'failed';
} else {
$status = 'success';
$mc->set('think_sms_send', 'true', 0, C('SMS_INTERVAL'));
}
}
//记录日志
if (C('LOG_RECORD')) {
Log::record($msg . ';detail:' . $detail . '【status:' . $status . '】', 'SEND_SMS', true);
} else {
Log::write($msg . ';detail:' . $detail . '【status:' . $status . '】', 'SEND_SMS');
}
}
示例6: read
/**
*get
*point,offset,status
*point:请求界点,status订单状态,offset个数,为正则取大于界点point的offset个元素,反之取小于point的offset个元素
**/
protected function read()
{
$input = $this->get;
$ret = $input && $input['point'] !== false && $input['offset'] !== false && $input['status'];
if ($ret) {
$condition['token'] = $this->token;
$condition['hid'] = $this->hid;
$condition['order_status'] = $input['status'];
$limit = abs($input['offset']);
if ($input['point'] == -1) {
$ret = $this->model->listOrders($condition, $limit, true);
} else {
$is_desc = $input['offset'] < 0;
$opration_con = $is_desc ? 'lt' : 'gt';
//lt 小于,gt 大于
$condition['id'] = array($opration_con, $input['point']);
$ret = $this->model->listOrders($condition, $limit, $is_desc);
}
}
if ($ret !== false) {
$this->success("操作成功!", $ret);
} else {
$this->error('error in read');
Log::record('error' . print_r($input) . '\\n');
}
}
示例7: init
/**
* session初始化
* @param array $config
* @return void
* @throws \think\Exception
*/
public static function init(array $config = [])
{
if (empty($config)) {
$config = Config::get('session');
}
// 记录初始化信息
APP_DEBUG && Log::record('[ SESSION ] INIT ' . var_export($config, true), 'info');
$isDoStart = false;
if (isset($config['use_trans_sid'])) {
ini_set('session.use_trans_sid', $config['use_trans_sid'] ? 1 : 0);
}
// 启动session
if (!empty($config['auto_start']) && PHP_SESSION_ACTIVE != session_status()) {
ini_set('session.auto_start', 0);
$isDoStart = true;
}
if (isset($config['prefix'])) {
self::$prefix = $config['prefix'];
}
if (isset($config['var_session_id']) && isset($_REQUEST[$config['var_session_id']])) {
session_id($_REQUEST[$config['var_session_id']]);
} elseif (isset($config['id']) && !empty($config['id'])) {
session_id($config['id']);
}
if (isset($config['name'])) {
session_name($config['name']);
}
if (isset($config['path'])) {
session_save_path($config['path']);
}
if (isset($config['domain'])) {
ini_set('session.cookie_domain', $config['domain']);
}
if (isset($config['expire'])) {
ini_set('session.gc_maxlifetime', $config['expire']);
ini_set('session.cookie_lifetime', $config['expire']);
}
if (isset($config['use_cookies'])) {
ini_set('session.use_cookies', $config['use_cookies'] ? 1 : 0);
}
if (isset($config['cache_limiter'])) {
session_cache_limiter($config['cache_limiter']);
}
if (isset($config['cache_expire'])) {
session_cache_expire($config['cache_expire']);
}
if (!empty($config['type'])) {
// 读取session驱动
$class = (!empty($config['namespace']) ? $config['namespace'] : '\\think\\session\\driver\\') . ucwords($config['type']);
// 检查驱动类
if (!class_exists($class) || !session_set_save_handler(new $class($config))) {
throw new \think\Exception('error session handler', 11700);
}
}
if ($isDoStart) {
session_start();
self::$active = true;
}
}
示例8: system_init
public static function system_init()
{
parent::system_init();
if (!self::is_enabled()) {
return null;
}
\Log::record(__FILE__, "Test module is enable");
}
示例9: query
public function query($sql)
{
$result = mysql_query($sql, $this->conn);
if (DEBUG_MODE) {
Log::record($sql);
}
return $result ? $result : false;
}
示例10: getCompanyStatus
public function getCompanyStatus()
{
$Form = D("company");
$con['cid'] = $_POST['cid'];
$Info = $Form->where($con)->getField('status');
Log::record($Info);
$this->ajaxReturn($Info, 'Yes', 1);
}
示例11: autoload
public static function autoload($class)
{
// 检测命名空间别名
if (!empty(self::$namespaceAlias)) {
$namespace = dirname($class);
if (isset(self::$namespaceAlias[$namespace])) {
$original = self::$namespaceAlias[$namespace] . '\\' . basename($class);
if (class_exists($original)) {
return class_alias($original, $class, false);
}
}
}
// 检查是否定义类库映射
if (isset(self::$map[$class])) {
if (is_file(self::$map[$class])) {
// 记录加载信息
APP_DEBUG && (self::$load[] = self::$map[$class]);
include self::$map[$class];
} else {
return false;
}
} elseif ($file = self::findFileInComposer($class)) {
// Composer自动加载
// 记录加载信息
APP_DEBUG && (self::$load[] = $file);
include $file;
} else {
// 命名空间自动加载
if (!strpos($class, '\\')) {
return false;
}
// 解析命名空间
list($name, $class) = explode('\\', $class, 2);
if (isset(self::$namespace[$name])) {
// 注册的命名空间
$path = self::$namespace[$name];
} elseif (is_dir(EXTEND_PATH . $name)) {
// 扩展类库命名空间
$path = EXTEND_PATH . $name . DS;
} else {
return false;
}
$filename = $path . str_replace('\\', DS, $class) . EXT;
if (is_file($filename)) {
// 开启调试模式Win环境严格区分大小写
if (APP_DEBUG && IS_WIN && false === strpos(realpath($filename), $class . EXT)) {
return false;
}
// 记录加载信息
APP_DEBUG && (self::$load[] = $filename);
include $filename;
} else {
Log::record('autoloader error : ' . $filename, 'notice');
return false;
}
}
return true;
}
示例12: log
/**
* 记录日志
* @param unknown $content 日志内容
* @param boolean $if_sql 是否记录SQL
*/
protected function log($content, $if_sql = true) {
if ($if_sql) {
$log = Log::read();
if (!empty($log) && is_array($log)){
$content .= end($log);
}
}
Log::record('queue\\'.$content,Log::RUN);
}
示例13: testLaunchFile
public function testLaunchFile()
{
\Core::require_file('core', 'Tools\\Log.php');
\Log::drop();
\Log::record('CoreTest', 'Just a test');
$log = \Log::get();
$datetime = date('d-m-Y H:i:s');
$this->assertEquals($log, "[{$datetime}] : Just a test (CoreTest)\r\n");
}
示例14: alarm
/**
* 通知初始化
* @return void
*/
public static function alarm($config = [])
{
$type = isset($config['type']) ? $config['type'] : 'Email';
$class = (!empty($config['namespace']) ? $config['namespace'] : '\\think\\log\\alarm\\') . ucwords($type);
unset($config['type']);
self::$alarm = new $class($config['alarm']);
// 记录初始化信息
APP_DEBUG && Log::record('[ CACHE ] ALARM ' . $type . ': ' . var_export($config, true), 'info');
}
示例15: _initialize
protected function _initialize()
{
define('PHONE_PAY', 9000);
define('INTERNET_PAY', 9001);
parent::_initialize();
//获取合作伙伴id
$fxs_id = $this->_get('fxs_id');
if (!$fxs_id) {
$fxs_id = session('fxs_id');
}
$this->fxs_userid = $fxs_id;
session('fxs_id', $fxs_id);
$this->wechat_id = session('wechat_id_' . $this->token);
$this->branch_id = $this->_get('partner_id');
$opened_funcs = session('opened_funcs_' . $this->token);
$cur_func = 'shangcheng';
if (!in_array($cur_func, $opened_funcs)) {
Log::record('Shop function verification failed: token:' . $this->token . ' opened_funcs:' . print_r($opened_funcs, true));
Log::save();
echo 'Sorry!';
exit;
}
$this->is_need_auth = $this->isNeedDoAuth();
$this->assign('token', $this->token);
$this->assign('staticFilePath', str_replace('./', '/', THEME_PATH . 'common/css/product'));
//购物车信息
$cart_items = $this->getCart();
$item_count = 0;
foreach ($cart_items as $key => $item) {
$item_count += $item['count'];
}
$this->assign('cart_item_count', $item_count);
//商城信息
$shop_where = array('token' => $this->token, 'status' => 1);
$this->branch_id = intval($_GET['bid']);
if (!empty($this->branch_id)) {
$shop_where['fake_id'] = $this->branch_id;
}
$shop_db = M('b2c_shop');
$shop = $shop_db->where($shop_where)->find();
if (empty($this->branch_id)) {
$this->branch_id = $shop['fake_id'];
}
$this->assign('shop', $shop);
$my_url = '#';
if ($this->is_need_auth && !$this->wechat_id) {
$my_url = $this->generateAuthUrl('Shop/my', array('fxs_id' => $fxs_id));
} else {
$my_url = $this->generateUrl('Shop/my', array('fxs_id' => $fxs_id));
}
$this->assign('my_url', $my_url);
$cart_url = $this->generateUrl('Shop/cart', array('bid' => $this->branch, 'fxs_id' => $fxs_id, 'partner_id' => $this->branch_id));
$this->assign('cart_url', $cart_url);
$home_url = $this->generateUrl('Shop/index', array('fxs_id' => $fxs_id));
$this->assign('home_url', $home_url);
}