本文整理汇总了PHP中log_file函数的典型用法代码示例。如果您正苦于以下问题:PHP log_file函数的具体用法?PHP log_file怎么用?PHP log_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了log_file函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sqs_client_enqueue
function sqs_client_enqueue($data, $config)
{
$result = array();
$err = '';
$region = empty($config['sqs_region']) ? empty($config['s3_region']) ? 'us-east-1' : $config['s3_region'] : $config['sqs_region'];
// fallback to same region as s3 bucket
$message_id = '';
$options_array = ['version' => 'latest', 'region' => $region];
if ($config['aws_secret_access_key'] && $config['aws_access_key_id']) {
$options_array['credentials'] = [];
$options_array['credentials']['key'] = $config['aws_access_key_id'];
$options_array['credentials']['secret'] = $config['aws_secret_access_key'];
}
try {
$sqs = new Aws\Sqs\SqsClient($options_array);
$response = $sqs->sendMessage(['MessageBody' => json_encode($data), 'QueueUrl' => $config['sqs_queue_url']]);
if ($config['log_api_response']) {
log_file("sqs response:\n" . print_r($response, 1), $config);
}
if (empty($response['MessageId'])) {
$err = 'Got no MessageId in sqs response';
} else {
$result['id'] = $response['MessageId'];
}
} catch (Exception $e) {
$err = $e->getMessage();
}
if ($err) {
$result['error'] = $err;
}
return $result;
}
示例2: sqs_client_enqueue
function sqs_client_enqueue($data, $config)
{
$result = array();
$err = '';
$variables = array();
$variables['Action'] = 'SendMessage';
$variables['MessageBody'] = json_encode($data);
$variables['Version'] = '2012-11-05';
$parsed_url = parse_url($config['sqs_queue_url']);
$headers = array();
$headers['Host'] = strtolower($parsed_url['host']);
$headers['X-Amz-Date'] = gmdate(DATE_FORMAT_ISO8601_BASIC);
$signature = __sqs_client_version_four($config['aws_secret_access_key'], $config['sqs_queue_url'], $variables, $headers, $config['s3_region'], 'post');
$region = empty($config['sqs_region']) ? empty($config['s3_region']) ? 'us-east-1' : $config['s3_region'] : $config['sqs_region'];
// fallback to same region as s3 bucket
$date_str = substr($headers['X-Amz-Date'], 0, 8);
$headers['Authorization'] = "AWS4-HMAC-SHA256 Credential={$config['aws_access_key_id']}/{$date_str}/{$region}/sqs/aws4_request, SignedHeaders=host;x-amz-date, Signature={$signature}";
$post_result = http_send($config['sqs_queue_url'], $variables, $headers);
$data = $post_result['result'];
if ($data && $config['log_api_response']) {
log_file("sqs response:\n" . print_r($data, 1), $config);
}
if ($post_result['error']) {
$err = 'Could not make sqs request ' . $config['sqs_queue_url'] . ' ' . $post_result['error'];
} else {
if (!$data) {
$err = 'Got no response from sqs request';
} else {
$xml = @simplexml_load_string($data, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NOENT);
if (!is_object($xml)) {
$err = 'Could not parse sqs response';
} else {
if (sizeof($xml->Error)) {
if (!$config['log_api_response']) {
log_file("sqs response:\n" . $data, $config);
}
$err = 'Got error in sqs response';
} else {
if (!(is_object($xml->SendMessageResult) && is_object($xml->SendMessageResult->MessageId))) {
$err = 'Got no MessageId in sqs response';
} else {
$result['id'] = (string) $xml->SendMessageResult->MessageId;
}
}
}
}
}
if ($err) {
$result['error'] = $err;
}
return $result;
}
示例3: handleScan
/**
* 处理扫描场景值关注
* 1.若未关注公众号,则会触发subscrible事件,EventKey中带有场景值(如:qrscene_Qggg)
* 2.若已关注公众号,则会触发scan事件,EventKey中带有场景值(如:Qggg)
* 3.注意两者区别
* @param $postObj
*/
function handleScan($postObj)
{
$uid = 0;
$params = array(array("" . $postObj->FromUserName, SQLSRV_PARAM_IN), array("" . $postObj->ToUserName, SQLSRV_PARAM_IN), array($uid, SQLSRV_PARAM_OUT));
sp_execute("{call app_subscrible(?,?,?)}", $params);
//用户扫描带场景值二维码
$scenestr = explode("-", $postObj->EventKey);
$uid_from = str2num(CFG_ID_USER, $scenestr[0]);
$cid = str2num(CFG_ID_CAR, $scenestr[1]);
log_file("scan, uid_from:{$uid_from}, cid:{$cid}, uid:{$uid}");
//共享车辆
$params = array(array($cid, SQLSRV_PARAM_IN), array($uid_from, SQLSRV_PARAM_IN), array($uid, SQLSRV_PARAM_IN));
sp_execute("{call app_share_car(?,?,?)}", $params);
//查询分享发起人信息
$params = array(array($uid_from, SQLSRV_PARAM_IN), array("", SQLSRV_PARAM_IN));
$rs = sp_execute("{call app_get_userinfo(?,?)}", $params);
//准备图文消息
$newsContent = array("title" => "好友" . $rs[0]["nickname"] . "的车辆信息", "description" => "点击查看详情", "picUrl" => CFG_HTTP . CFG_CAR_DEFAULT, "url" => CFG_HTTP . "mobile/car_list.php");
response_news($postObj, $newsContent);
}
示例4: handleEvent
function handleEvent($postObj)
{
if ($postObj->Event == "subscribe") {
handleSubscribe($postObj);
} else {
if ($postObj->Event == "unsubscribe") {
handleUnsubscribe($postObj);
} else {
if ($postObj->Event == "SCAN") {
handleScan($postObj);
} else {
if ($postObj->Event == "CLICK") {
handleClick($postObj);
} else {
if ($postObj->Event == "VIEW") {
log_file("view test");
} else {
if ($postObj->Event == "TEMPLATESENDJOBFINISH") {
log_file("template msg send finished");
} else {
if ($postObj->Event == "LOCATION") {
handleLocation($postObj);
}
}
}
}
}
}
}
}
示例5: time
$offset = 0;
}
}
//设置偏移值有效期时间10分钟
$time = time() + 600;
setcookie($offset_tag, $offset, $time, "/");
if (isset($_REQUEST["s"])) {
$s = $_REQUEST["s"];
$mode = $s == "d" ? "1" : ($s == "w" ? "2" : ($s == "m" ? "3" : ""));
}
//
if (isset($_SESSION["offset"])) {
$offset = $_SESSION["offset"];
unset($_SESSION["offset"]);
}
log_file("cid=" . $_SESSION["cid"] . ", mode={$mode}, offset={$offset}");
$params = array(array(intval($_SESSION["cid"]), SQLSRV_PARAM_IN), array($mode, SQLSRV_PARAM_IN), array($offset, SQLSRV_PARAM_IN), array($sdt, SQLSRV_PARAM_OUT), array($edt, SQLSRV_PARAM_OUT));
$rs = sp_execute("{call app_get_car_travel_list(?,?,?,?,?)}", $params);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, width=device-width, maximum-scale=1, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<title><?php
echo $_SESSION["carnum"];
?>
</title>
<link rel="icon" href="../images/favicon.ico" type="image/x-icon">
<link href="css/style.css?v=16" rel="stylesheet">
示例6: VALUES
}
//HERE WE CARRY ONE WITH ACTIVE ITEM. WE GIVE A NEW ITEM THE WEIGHT OF THE MOST ACTIVE WEIGHT
$item_ca_ac = $active_item_token;
// here was in sql inserting item_ca but now we change inser statemet to item_ca_ac
if ($item_ca_ac != 0) {
if ($omit != 1 or !empty($item_ca_ac)) {
$INSERT_LOG .= $barcode . $item . $brand . $serial . $item_ca;
$insert2 = "INSERT INTO `item`(`pn` ,`brand` ,`name`,Item_has_Cat_id_item_cat) VALUES ('{$serial}','{$brand}','{$item}','{$item_ca_ac}')";
$BUF_MESSG = $ro;
mysql_query($insert2) or die(mysql_error());
$last_id = mysql_insert_id();
$insert3 = "INSERT INTO `barcode` (`Item_id_item` ,`Barcode` ,`serial` ,`date`,stock_in,user_2,Site_site_id) VALUES ('{$last_id}','{$barcode}','0',NOW(),'1','{$user}','{$sesja}')";
mysql_query($insert3) or die("INSERT Barcode Wrong");
$INSERT_LOG .= $last_id . $sesja . $user;
$INSERT_LOG .= date();
log_file($INSERT_LOG);
$MESSG = 1;
}
} else {
$MESSG = 12;
}
} else {
//if not an bacode item yet in stock and type is not yet
//// this modul/part happens only while wher item name was not in database. This creates a fresh weight
//item weight
echo "kolo inersta innasdddddddddddddddddduuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuwe";
if ($WEIGHT_PASS == 1) {
if ($IS_SET_WEIGHT == 2) {
} else {
$IS_SET_WEIGHT = 1;
$url = "add_stock.php?barcode=" . swap_hash($barcode) . "&item=" . $item . "&brand=" . $brand . "&serial=" . $serial . '&IS_SET_WEIGHT=1';
示例7: log_warning
function log_warning($msg)
{
$msg = " [WARN] " . $msg;
$filename = "../logs/warning_" . date('Y-m-d') . ".log";
log_file($msg, $filename);
}
示例8: sp_execute
sp_execute("{call app_car_bind_dev(?,?,?)}", $params);
}
$status = "ok";
$info = "成功";
log_file("user_save_car:5");
} else {
if ($oper == "edit") {
log_file("user_save_car:6");
//修改
$params = array(array($_SESSION["cid"], SQLSRV_PARAM_IN), array("" . $_REQUEST["carnum"], SQLSRV_PARAM_IN), array("" . $picurl, SQLSRV_PARAM_IN));
sp_execute("{call app_set_car(?,?,?)}", $params);
$status = "ok";
}
}
} else {
log_file("user_save_car:7");
$status = "error";
$info = "车牌号为空";
}
} else {
if ($action == "user_bind_dev") {
$res = " ";
$params = array(array($_SESSION["cid"], SQLSRV_PARAM_IN), array("" . $_REQUEST["devnum"], SQLSRV_PARAM_IN), array($res, SQLSRV_PARAM_OUT));
sp_execute("{call app_car_bind_dev(?,?,?)}", $params);
$status = $res;
$info = "绑定成功";
} else {
if ($action == "user_unbind_dev") {
$params = array(array($_SESSION["cid"], SQLSRV_PARAM_IN));
sp_execute("{call app_car_unbind(?)}", $params);
$status = "ok";
示例9: path_concat
}
}
}
if (!$err) {
// try to move upload into its media directory and change permissions
$path = path_concat(path_concat(path_concat(path_concat($config['web_root_directory'], $config['user_media_directory']), $uid), $id), $config['import_original_basename'] . '.' . $file_extension);
if (!file_safe($path, $config)) {
$err = 'Problem creating media directory';
} else {
if (!file_move_upload($file['tmp_name'], $path)) {
$err = 'Problem moving file';
} else {
if (!file_mode($path, $config)) {
$err = 'Problem setting permissions of media: ' . $path;
} else {
log_file('Saved to: ' . $path, $config);
}
}
}
$response['status'] = 'uploaded ok';
}
if ($err) {
$response['error'] = $err;
} else {
$response['ok'] = 1;
}
$json = json_encode($response);
print $json . "\n\n";
if (!empty($log_responses)) {
log_file($json, $config);
}
示例10: redirect_url
function redirect_url($url = null, $debug = false)
{
if (empty($url)) {
$url = $_SERVER['HTTP_REFERER'];
}
if (defined('LOG_REDIRECTS')) {
log_file($url, 'redirect');
}
if ($debug) {
echo $url;
} else {
header('location:' . $url);
}
die;
}
示例11: api_queue_job
function api_queue_job($data, $config = array())
{
$result = array();
if (!$config) {
$config = config_get();
}
$result['error'] = config_error($config);
// queue job
if (empty($result['error'])) {
if ($config['log_api_request']) {
log_file("{$config['client']} request:\n" . json_encode($data), $config);
}
// post job to the Transcoder
$result = service_enqueue($data, $config);
if (empty($result['error']) && empty($result['id'])) {
$result['error'] = 'Got no Job ID';
}
}
return $result;
}
示例12: Verify
<?php
require_once "Verify.class.php";
require_once "../include/php_funs.php";
$verify = new Verify();
$verify->entry(1);
log_file("se_verify_code:" . $_SESSION["se_verify_code"]["verify_code"]);
示例13: catch
<?php
require '_require.php';
Stripe::setApiKey(STRIPE_SECRET);
try {
$stripe_charge = Stripe_Charge::create(array('amount' => $_POST['pay'] * 100, 'currency' => $_POST['currency'], 'card' => $_POST['stripe'], 'description' => 'Single payment'));
} catch (Exception $e) {
die('Unfortunately something has gone wrong. No payment has been taken. The Stripe payment gateway reported: ' . $e->getMessage());
log_file(print_r($e, true), 'Pay', DIR . 'logs/stripe-errors.log');
}
log_file(print_r($stripe_charge, true), 'Pay', DIR . 'logs/stripe.log');
try {
$stripe_charge = $stripe_charge->capture();
// if this fails the card has already been charged
} catch (Exception $e) {
log_file(print_r($e, true), 'Charge', DIR . 'logs/stripe-errors.log');
}
redirect('index.php?paid=' . $_POST['pay']);
示例14: array
}
if (!$err) {
$query = array();
foreach ($_GET as $k => $v) {
switch ($k) {
case 'index':
case 'count':
case 'group':
case 'unique':
break;
default:
$query[$k] = $v;
}
}
$options = array();
$options['group'] = $group;
$options['index'] = $index;
$options['count'] = $count;
$options['query'] = $query;
$options['uid'] = auth_userid();
$json_str = json_encode(data_search($options, $config));
}
if ($err) {
log_file($err, $config);
print '[]';
} else {
print $json_str;
}
if (!empty($log_responses)) {
log_file($json_str, $config);
}
示例15: path_concat
case 'video':
$frame_extension = 'jpg';
// otherwise use image's original extension (eg. png)
// otherwise use image's original extension (eg. png)
case 'image':
$encoder_fps = $config['import_fps'];
if ($type == 'image') {
$encoder_fps = '1';
}
// move any frames
$archive_path = path_concat($archive_dir, $config['import_dimensions'] . 'x' . $encoder_fps);
if (file_exists($archive_path)) {
$media_path = path_concat($media_dir, $config['import_dimensions'] . 'x' . $encoder_fps);
if (!file_move_extension($frame_extension, $archive_path, $media_path, $config)) {
$err = 'Could not move ' . $frame_extension . ' files from ' . $archive_path . ' to ' . $media_path;
}
}
break;
}
}
// remove the temporary directory we created, and any remaining files (there shouldn't be any)
file_dir_delete_recursive($tmp_path);
}
if ($err) {
header('HTTP/1.1: 400 Bad Request');
header('Status: 400 Bad Request');
print $err;
log_file($err, $config);
} else {
log_file($media_path, $config);
}