本文整理汇总了PHP中think\Log::write方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::write方法的具体用法?PHP Log::write怎么用?PHP Log::write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类think\Log
的用法示例。
在下文中一共展示了Log::write方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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', '数据丢失!');
}
示例2: 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");
}
示例3: _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;
}
示例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'));
}
示例5: 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;
}
}
}
示例6: 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;
}
示例7: 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);
}
示例8: 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);
}
示例9: buildRequestForm
public function buildRequestForm(\Org\Util\Pay\PayVo $vo)
{
$param = array('nonce_str' => (string) mt_rand(), 'spbill_create_ip' => get_client_ip(), 'device_info' => 'WEB', 'appid' => $this->config['appid'], 'mch_id' => $this->config['mch_id'], 'notify_url' => $this->config['notify_url'], 'out_trade_no' => $vo->getOrderNo(), 'body' => $vo->getTitle(), 'detail' => $vo->getBody(), 'total_fee' => $vo->getFee(), 'trade_type' => $vo->getType(), 'product_id' => $vo->getId(), 'openid' => $vo->getOpenid());
\Think\Log::write("11111" . $this->config['notify_url']);
$param['sign'] = $this->signatureArithmetic($param);
$param = $this->xml_encode($param);
$order = $this->fsockOpen($this->gateway, 0, $param);
return (array) simplexml_load_string($order, 'SimpleXMLElement', LIBXML_NOCDATA);
}
示例10: setForeverImageSource
public function setForeverImageSource()
{
$access_token = $this->getAccessToken();
$path = "/var/www/v.vxndy.com/Public/images/shasha.jpg";
$vars = array('media' => '@' . $path);
$url = "https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=" . $access_token;
$result = postCURL($url, $vars);
Log::write('新增永久素材返回信息:' . $result);
}
示例11: createMenu
public function createMenu()
{
Log::write("开始创建自定义菜单");
$access_token = $this->getAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" . $access_token;
$vars = C('MENU_ONE');
$result = postCURL($url, $vars);
Log::write("创建自定义菜单返回消息:" . $result);
}
示例12: getForverQrcodeTicket
public function getForverQrcodeTicket()
{
$token = $this->getAccessToken();
$scene_id = mt_rand(0, 100000);
$vars = '{"action_name": "QR_LIMIT_SCENE", "action_info": {"scene": {"scene_id": ' . $scene_id . '}}}';
Log::write('获得永久二维码ticket需要的参数:' . $vars);
$url = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=" . $token;
$result = postCURL($url, $vars);
Log::write('获得永久二维码返回ticket返回值:' . $result);
return json_decode($result, TRUE);
}
示例13: _fetchAccessToken
/**
* 获取Access Token
* @return null | string
*/
private function _fetchAccessToken()
{
$Curl = new Curl();
$params['grant_type'] = 'client_credential';
$params['appid'] = get_opinion('Weixin_appid');
$params['secret'] = get_opinion('Weixin_secret');
$accessToken = $Curl->callApi($this::$AccessTokenURL, $params, 'GET');
if (!isset($accessToken['access_token'])) {
Log::write("Error occurred when call AccessToken Api");
return null;
}
return $accessToken['access_token'];
}
示例14: 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;
}
}
示例15: log
/**
* log overwrite
* @see Wechat::log()
*/
protected function log($log)
{
if ($this->debug) {
if (function_exists($this->logcallback)) {
if (is_array($log)) {
$log = print_r($log, true);
}
return call_user_func($this->logcallback, $log);
} elseif (class_exists('\\Think\\Log')) {
\Think\Log::write('wechat:' . $log, \Think\Log::DEBUG);
}
}
return false;
}