当前位置: 首页>>代码示例>>PHP>>正文


PHP think\Log类代码示例

本文整理汇总了PHP中think\Log的典型用法代码示例。如果您正苦于以下问题:PHP Log类的具体用法?PHP Log怎么用?PHP Log使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Log类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 public function index()
 {
     if (!isset($_GET['code'])) {
         $redirect_uri = URL2;
         $scope = 'snsapi_base';
         $log = new Log();
         $log->write("order请求", 'DEBUG', '', dirname($_SERVER['SCRIPT_FILENAME']) . '/Logs/Weixin/' . date('y/m/d') . '.log');
         $this->oauth($redirect_uri, $scope);
         // $this->get_city();
     } else {
         $code = (string) $_GET['code'];
         $open_id = $this->get_oauth_openid($code);
         $log = new Log();
         $log->write("order微信回调", 'DEBUG', '', dirname($_SERVER['SCRIPT_FILENAME']) . '/Logs/Weixin/' . date('y/m/d') . '.log');
     }
     $user_model = M("User");
     $where = array('openid' => (string) $open_id);
     $user = $user_model->where($where)->find();
     $user_id = $user['id'];
     $orderlist = $this->get_user_order($user_id);
     /*
      * $msg = $this->get_endorsement (); print_r ( $msg );
      */
     $order_status = array(1 => '未支付', 2 => '确认中', 3 => '处理中', 5 => '已处理', 6 => '退款中', 7 => '已退款', 8 => '已取消');
     $this->assign('user_id', $user_id);
     $this->assign('order_status', $order_status);
     $this->assign('orderlist', $orderlist);
     $this->display(":order");
 }
开发者ID:xiaoxianlink,项目名称:ziniu,代码行数:29,代码来源:OrderController.class.php

示例2: sendWeiXin

 public function sendWeiXin($touser, $template_id, $url, $data, $topcolor = '#7B68EE')
 {
     $log = new Log();
     $template = array('touser' => $touser, 'template_id' => $template_id, 'url' => $url, 'topcolor' => $topcolor, 'data' => $data);
     $json_template = json_encode($template);
     $url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" . $this->get_access_token();
     $dataRes = $this->request_post($url, urldecode($json_template));
     $log->write(serialize($dataRes), 'DEBUG', '', dirname($_SERVER['SCRIPT_FILENAME']) . '/Logs/Weixin/' . date('y_m_d') . '.log');
     if ($dataRes['errcode'] == 0) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:xiaoxianlink,项目名称:ziniu,代码行数:14,代码来源:ApiController.class.php

示例3: testRecord

 public function testRecord()
 {
     $record_msg = 'record';
     Log::record($record_msg, 'notice');
     $logs = Log::getLog();
     $this->assertNotFalse(array_search(['type' => 'notice', 'msg' => $record_msg], $logs));
 }
开发者ID:Lofanmi,项目名称:think,代码行数:7,代码来源:fileTest.php

示例4: testWrite

 public function testWrite()
 {
     Log::init(['type' => 'test']);
     Log::clear();
     $this->assertTrue(Log::write('hello', 'info'));
     $this->assertTrue(Log::write([1, 2, 3], 'log'));
 }
开发者ID:Lofanmi,项目名称:think,代码行数:7,代码来源:logTest.php

示例5: j_email

 public function j_email()
 {
     // 如果
     if (isset($_POST['em'])) {
         $email = $_POST['em'];
         $account_model = D('Account');
         // 证明已经注册过
         if ($account_model->judge_account_id_isset($email)) {
             Response::show('-101', '该邮箱已经被注册!');
         } else {
             // 发送给用户的信息
             $rand_string = strtolower(rand_string());
             $title = '欢迎您注册!么么哒。';
             $content = '您好,您的注册验证码是 : ' . $rand_string . '   !, 如果不是本人操作,请忽略!';
             $Memcached = Memcached::getInstance();
             // 暂时不加密了。
             $Memcached->set($email, $rand_string);
             if (SendMail($email, $title, $content) === true) {
                 Response::show('200', '已经发送验证码,请注意查收!');
             } else {
                 Log::write('发送验证码失败,to [--' . $email . '--]', 'WARN');
                 Response::show('-102', '邮件发送失败,未知原因!');
             }
         }
     }
     Response::show('-103', '数据丢失!');
 }
开发者ID:xiaowei521,项目名称:future-1,代码行数:27,代码来源:AjaxController.class.php

示例6: sendsms

 public function sendsms()
 {
     if (IS_POST) {
         $mac = md5($_POST['time'] . C('SMSKEY'));
         if ($mac != $_POST['mac']) {
             return false;
         }
         if (empty($_POST['content']) || empty($_POST['phone'])) {
             return false;
         }
         $path = C('LOG_PATH') . 'sms.txt';
         Log::write($_POST['phone'] . ':' . $_POST['content'], 'SMS-CONTENT', '', $path);
         $data = array('userid' => 416, 'account' => 'HY-jmzc', 'password' => 'Hj1234', 'mobile' => $_POST['phone'], 'content' => $_POST['content'], 'sendTime' => '', 'action' => 'send', 'checkcontent' => '0', 'taskName' => '', 'countnumber' => $_POST['count'], 'mobilenumber' => $_POST['count'], 'telephonenumber' => 0);
         // 短信发送
         $xml = curlPost($this->url, $data);
         Log::write($xml, 'SMS-CONTENT', '', $path);
         $res = simplexml_load_string($xml);
         $arr = json_decode(json_encode($res), true);
         if ($arr['returnstatus'] == 'Success') {
             echo true;
         } else {
             echo false;
         }
     }
 }
开发者ID:rainly123,项目名称:zyzm,代码行数:25,代码来源:SmsController.class.php

示例7: testRecord

 public function testRecord()
 {
     $record_msg = 'record';
     Log::record($record_msg, 'notice');
     $logs = Log::getLog();
     $this->assertNotFalse(array_search($record_msg, $logs['notice']));
 }
开发者ID:top-think,项目名称:framework,代码行数:7,代码来源:fileTest.php

示例8: NotifyProcess

 public function NotifyProcess($data, &$msg)
 {
     Log::write(json_encode($data));
     //记录下支付信息
     if (!array_key_exists("transaction_id", $data)) {
         $msg = "输入参数不正确";
         return false;
     }
     //查询订单,判断订单真实性
     if (!$this->Queryorder($data["transaction_id"])) {
         $msg = "订单查询失败";
         return false;
     }
     $order = D('Order');
     $order_info = $order->getOne(array('order_id' => $data['out_trade_no'], 'phone' => $data['attach']));
     if ($order_info && $order_info['status'] == 0) {
         $order_info['status'] = 1;
         $result = $order->editData($order_info);
         if ($result == CommonModel::MSUCCESS) {
             $point = D('Pointlog');
             $point->log($order_info['user_id'], $order_info['point'], "订单" . $order_info['order_id'] . " 使用了" . $order_info['point'] . "积分", PointlogModel::DEC);
             $money = $order_info['total'] / 100;
             $addpiont = intval($money / C('DEVPOINT'));
             $point->log($order_info['user_id'], $addpiont, "订单" . $order_info['order_id'] . " 获得了" . $addpiont . "积分", PointlogModel::ADD);
         }
     }
     return true;
 }
开发者ID:foryoufeng,项目名称:thinkmobile,代码行数:28,代码来源:PayNotifyCallBack.class.php

示例9: load

 /**
  * 加载语言定义(不区分大小写)
  * @param string $file 语言文件
  * @param string $range 语言作用域
  * @return mixed
  */
 public static function load($file, $range = '')
 {
     $range = $range ?: self::$range;
     if (!isset(self::$lang[$range])) {
         self::$lang[$range] = [];
     }
     // 批量定义
     if (is_string($file)) {
         $file = [$file];
     }
     $lang = [];
     foreach ($file as $_file) {
         if (is_file($_file)) {
             // 记录加载信息
             APP_DEBUG && Log::record('[ LANG ] ' . $_file, 'info');
             $_lang = (include $_file);
         } else {
             $_lang = [];
         }
         $lang = array_change_key_case($_lang) + $lang;
     }
     if (!empty($lang)) {
         self::$lang[$range] = $lang + self::$lang[$range];
     }
     return self::$lang[$range];
 }
开发者ID:xuyi5918,项目名称:ipensoft,代码行数:32,代码来源:Lang.php

示例10: sendTemplateSMS

 /**
  * 发送模板短信
  * @param String $to 短信接收彿手机号码集合,用英文逗号分开
  * @param array $datas 内容数据 格式为数组 例如:array('Marry','Alon'),如不需替换请填 null
  * @param int $tempId 模板Id,测试应用和未上线应用使用测试模板请填写1,正式应用上线后填写已申请审核通过的模板ID
  * @return 内容数据|mixed
  */
 function sendTemplateSMS($to, $datas, $tempId)
 {
     $this->Batch = date("YmdHis");
     // 拼接请求包体
     $data = "";
     for ($i = 0; $i < count($datas); $i++) {
         $data = $data . "'" . $datas[$i] . "',";
     }
     $body = "{'to':'{$to}','templateId':'{$tempId}','appId':'{$this->AppId}','datas':[" . $data . "]}";
     $level = Log::INFO;
     Log::record("response body = " . $body, $level);
     // 大写的sig参数
     $sig = strtoupper(md5($this->AccountSid . $this->AccountToken . $this->Batch));
     // 生成请求URL
     $url = "https://{$this->ServerIP}:{$this->ServerPort}/{$this->SoftVersion}/Accounts/{$this->AccountSid}/SMS/TemplateSMS?sig={$sig}";
     Log::record("request url = " . $url, $level);
     // 生成授权:主帐户Id + 英文冒号 + 时间戳。
     $authen = base64_encode($this->AccountSid . ":" . $this->Batch);
     // 生成包头
     $header = array("Accept:application/{$this->BodyType}", "Content-Type:application/{$this->BodyType};charset=utf-8", "Authorization:{$authen}");
     // 发送请求
     $result = $this->curl_post($url, $body, $header);
     Log::record("response body = " . $result, $level);
     $datas = json_decode($result);
     //重新装填数据
     if ($datas->statusCode == 0) {
         if ($this->BodyType == "json") {
             $datas->TemplateSMS = $datas->templateSMS;
             unset($datas->templateSMS);
         }
     }
     return $datas;
 }
开发者ID:Emon0526,项目名称:zhuoying-wx,代码行数:40,代码来源:SmsLogic.class.php

示例11: getAllAddon

 /**
  * 获取插件列表
  * @param string $addon_dir
  * @author jry <598821125@qq.com>
  */
 public function getAllAddon($addon_dir = THINK_ADDON_PATH)
 {
     $dirs = array_map('basename', glob($addon_dir . '*', GLOB_ONLYDIR));
     if ($dirs === FALSE || !file_exists($addon_dir)) {
         $this->error = '插件目录不可读或者不存在';
         return FALSE;
     }
     $addons = array();
     $map['name'] = array('in', $dirs);
     $list = $this->where($map)->field(true)->order('sort asc,id desc')->select();
     foreach ($list as $addon) {
         $addons[$addon['name']] = $addon;
     }
     foreach ($dirs as $value) {
         if (!isset($addons[$value])) {
             $class = get_addon_class($value);
             if (!class_exists($class)) {
                 // 实例化插件失败忽略执行
                 \Think\Log::record('插件' . $value . '的入口文件不存在!');
                 continue;
             }
             $obj = new $class();
             $addons[$value] = $obj->info;
             if ($addons[$value]) {
                 $addons[$value]['status'] = -1;
                 //未安装
             }
         }
     }
     foreach ($addons as &$val) {
         switch ($val['status']) {
             case '-1':
                 //未安装
                 $val['status'] = '<i class="glyphicon glyphicon-trash" style="color:red"></i>';
                 $val['right_button'] = '<a class="ajax-get" href="' . U('install?addon_name=' . $val['name']) . '">安装</a>';
                 break;
             case '0':
                 //禁用
                 $val['status'] = '<i class="glyphicon glyphicon-ban-circle" style="color:red"></i>';
                 $val['right_button'] = '<a href="' . U('config', array('id' => $val['id'])) . '">设置</a> ';
                 $val['right_button'] .= '<a class="ajax-get" href="' . U('setStatus', array('status' => 'resume', 'ids' => $val['id'])) . '">启用</a> ';
                 $val['right_button'] .= '<a class="ajax-get" href="' . U('uninstall?id=' . $val['id']) . '">卸载</a> ';
                 if ($val['adminlist']) {
                     $val['right_button'] .= '<a href="' . U('adminlist', array('name' => $val['name'])) . '">管理</a>';
                 }
                 break;
             case '1':
                 //正常
                 $val['status'] = '<i class="glyphicon glyphicon-ok" style="color:green"></i>';
                 $val['right_button'] = '<a href="' . U('config', array('id' => $val['id'])) . '">设置</a> ';
                 $val['right_button'] .= '<a class="ajax-get" href="' . U('setStatus', array('status' => 'forbid', 'ids' => $val['id'])) . '">禁用</a> ';
                 $val['right_button'] .= '<a class="ajax-get" href="' . U('uninstall?id=' . $val['id']) . '">卸载</a> ';
                 if ($val['adminlist']) {
                     $val['right_button'] .= '<a href="' . U('adminlist', array('name' => $val['name'])) . '">管理</a>';
                 }
                 break;
         }
     }
     return $addons;
 }
开发者ID:sayi21cn,项目名称:corethink,代码行数:65,代码来源:AddonModel.class.php

示例12: __construct

 /**
  * 构造函数
  */
 public function __construct($modelName = null)
 {
     if (!is_null($modelName)) {
         $this->setUserModelProvider($modelName);
     }
     Log::info('request_cookie', array('request' => $_COOKIE));
 }
开发者ID:minowu,项目名称:smartthink,代码行数:10,代码来源:Authentication.php

示例13: _sock_post

 protected function _sock_post($url, $query)
 {
     $data = "";
     $info = parse_url($url);
     $fp = fsockopen($info["host"], 80, $errno, $errstr, 30);
     if (!$fp) {
         return $data;
     }
     $head = "POST " . $info['path'] . " HTTP/1.0\r\n";
     $head .= "Host: " . $info['host'] . "\r\n";
     $head .= "Referer: http://" . $info['host'] . $info['path'] . "\r\n";
     $head .= "Content-type: application/x-www-form-urlencoded\r\n";
     $head .= "Content-Length: " . strlen(trim($query)) . "\r\n";
     $head .= "\r\n";
     $head .= trim($query);
     $write = fputs($fp, $head);
     $header = "";
     while ($str = trim(fgets($fp, 4096))) {
         $header .= $str;
     }
     while (!feof($fp)) {
         $data .= fgets($fp, 4096);
     }
     $ret = json_decode($data, true);
     if (!$ret) {
         \Think\Log::write('无法解析短信接口返回值:' . $data);
         return false;
     }
     return $ret;
 }
开发者ID:torry999,项目名称:lingshi,代码行数:30,代码来源:Sms.class.php

示例14: index

 public function index($arr = array())
 {
     Log::write('开始调用ResponseUnknowMessageController@index并获得参数' . json_encode($arr));
     $fromusername = $arr['fromusername'];
     $tousername = $arr['tousername'];
     $content = '[Cry][Cry][Cry]暂时不支持处理您的消息类型';
     $this->sendTextMessage($fromusername, $tousername, $content);
 }
开发者ID:lnmpoo,项目名称:wechat_tp,代码行数:8,代码来源:ResponseUnknowMessageController.class.php

示例15: index

 public function index($arr = array())
 {
     Log::write('开始调用ResponseImageMessageController@index并获得参数' . json_encode($arr));
     $fromusername = $arr['fromusername'];
     $tousername = $arr['tousername'];
     $mediaid = $arr['mediaid'];
     $this->sendImageMessage($fromusername, $tousername, $mediaid);
 }
开发者ID:lnmpoo,项目名称:wechat_tp,代码行数:8,代码来源:ResponseImageMessageController.class.php


注:本文中的think\Log类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。