• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP writeLog函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getDataJson

function getDataJson()
{
    if (isset($_GET['sfrom'])) {
        $jordanGUID = $_GET['jordanGUID'];
        $domain = $_GET['domain'];
        $protocol = $_GET['protocol'];
        $path = $_GET['path'];
        $location = $protocol . $domain . $path;
        $sfrom = $_GET['sfrom'];
        initConnection($db_config);
        //redis 使用
        require '../Predis/Autoloader.php';
        Predis\Autoloader::register();
        $redis = new Predis\Client(array('database' => '0', 'host' => '49.4.129.122', 'port' => 6379));
        $datestr = date("Y_m_d_H");
        $tableName = "request_" . $datestr;
        if ($redis->get("tableName") != $tableName) {
            create_request($tableName);
            $redis->set("tableName", $tableName);
        }
        $request_datetime = date('Y-m-d H:i:s', time());
        writeLog('../logs/' . $tableName . '.log', "{$jordanGUID}\t{$domain}\t{$location}\t{$request_datetime}\n", "a");
        insert_request_entry($jordanGUID, $domain, $location, $sfrom, $request_datetime, $tableName);
        insert_request_entry($jordanGUID, $domain, $location, $sfrom, $request_datetime, "request");
        //echo "success";
    } else {
        //echo "failure";
    }
}
开发者ID:sdgdsffdsfff,项目名称:jordan2,代码行数:29,代码来源:god_view.php


示例2: saveFile

/**
 * Save the revieved XML to file
 *
 * @param string $xml The xml recieved
 * @return boolean True on success or false
 */
function saveFile($xml)
{
    global $db;
    //In your database, log that you have received new xml data
    $db->query("INSERT INTO saved_xml () VALUES ()") or $db->raise_error('Failed saving xml');
    // Will use the message we give it + the SQL
    $id = $db->insert_id();
    //Save the data in a file, and name it using the autoincrement id from your database
    $filename = "files/{$id}.xml.gz";
    if (move_uploaded_file($xml, $filename)) {
        $unzipped_file = 'files/' . $id . '.xml';
        system("gunzip {$filename} 2>&1");
        if (file_exists($unzipped_file)) {
            //file is ready to parse
        } else {
            writeLog(array(), "Failed to gunzip file " . $filename);
            $db->query("DELETE FROM saved_xml WHERE id=" . $id) or $db->raise_error('Failed deleting XML row');
            // Will use the message we give it + the SQL
            return false;
        }
        //echo "The file $filename has been uploaded";
    } else {
        //echo "There was an error uploading the file, please try again!";
        $db->query("DELETE FROM saved_xml WHERE id=" . $id) or $db->raise_error('Failed deleting XML row');
        // Will use the message we give it + the SQL
        return false;
    }
    return true;
}
开发者ID:issarapong,项目名称:enetpulse-ingestion,代码行数:35,代码来源:receive_file.php


示例3: clear

 /**
  * 清除数据表
  * @author Mr.Cong <[email protected]>
  */
 public function clear(Request $request)
 {
     /**
      * 简单的判断,防止恶意执行
      */
     $pass = $request->input('auth', '0');
     if (md5($pass) != 'ceb8ecf822745c53f78a10c05cf01919') {
         echo "Auth failed.";
         exit;
     }
     /*
      * 每天定时清空数据库指定的表和日志、标注文件
      */
     $dir = './log/';
     if ($od = opendir($dir)) {
         while (($file = readdir($od)) !== false) {
             //跳过当前目录和上一级目录
             if (in_array($file, array(".", ".."))) {
                 continue;
             }
             if (preg_match('/\\.lock/', $file) || preg_match('/(\\w+)\\.html/', $file)) {
                 unlink($dir . $file);
             }
         }
     }
     DB::table('news')->truncate();
     DB::table('forums')->truncate();
     writeLog(date('Y-m-d H:i:s') . " Clear table and log file.");
     /*
      * 退出
      */
     print 0;
     exit;
 }
开发者ID:Cong5,项目名称:gdg-gsee,代码行数:38,代码来源:SpiderConroller.php


示例4: updatePicture

/** \brief Updates database ticket with stored image url
* \param picture_url Part of URL to the image
* \param upload_dir Directory in which the images are stored
* \param interaction_id Ticket identifier for updated image
* \returns Successful database update or unsuccessful
*/
function updatePicture($picture_url, $upload_dir, $interaction_id)
{
    try {
        require "/var/database_config.php";
        $pdo = new PDO('mysql:host=' . $db_config['host'] . ';dbname=' . $db_config['dbname'], $db_config['username'], $db_config['password']);
        $sql_str = "SELECT image from tickets WHERE interaction_id = ?";
        $statement = $pdo->prepare($sql_str);
        $statement->execute(array($interaction_id));
        $picture = $statement->fetch(PDO::FETCH_ASSOC);
        if ($picture['image'] !== NULL) {
            $temp = explode("/", $picture['image']);
            $file = end($temp);
            $picture_path = $upload_dir . $file;
            if (file_exists($picture_path)) {
                if (unlink($picture_path)) {
                    //return array('status' => 'File deleted');
                }
            }
        }
        $sql_str = "UPDATE tickets SET image = ? WHERE interaction_id = ?";
        $statement = $pdo->prepare($sql_str);
        $statement->execute(array($picture_url, $interaction_id));
        $logs = array();
        $logs[] = "Image added to ticket.";
        require "../log.php";
        writeLog($interaction_id, $logs);
        return array('status' => 'Successful image update');
    } catch (PDOException $e) {
        return array('error' => 'Error updating the image in the database');
    }
}
开发者ID:GM-Team,项目名称:web,代码行数:37,代码来源:index.php


示例5: kataDebugOutput

 /**
  * replace internal katadebug-function
  */
 function kataDebugOutput($var = null, $isTable = false)
 {
     if (!$isTable) {
         writeLog(var_export($var, true), 'boot');
     } else {
         $widths = array();
         foreach ($var as $line) {
             $cellNo = 0;
             foreach ($line as $cell) {
                 if (!isset($widths[$cellNo])) {
                     $widths[$cellNo] = 0;
                 }
                 $widths[$cellNo] = max($widths[$cellNo], strlen($cell));
                 $cellNo++;
             }
         }
         $output = "\n";
         foreach ($var as $line) {
             $s = '';
             $cellNo = 0;
             foreach ($line as $cell) {
                 $s .= $cell . str_repeat(' ', $widths[$cellNo] - strlen($cell)) . ' | ';
                 $cellNo++;
             }
             $output .= $s . "\n";
         }
         writeLog($output, 'boot');
     }
 }
开发者ID:emente,项目名称:kataii---kata-framework-2.x,代码行数:32,代码来源:log.php


示例6: RatepayRequestAction

 /**
  * RatePAY action method handles payment request
  */
 public function RatepayRequestAction()
 {
     include_once dirname(__FILE__) . '/../../Views/Frontend/Ratenrechner/php/pi_ratepay_xml_service.php';
     Shopware()->Session()->pi_ratepay_Confirm = false;
     $user = $this->getUser();
     $payName = $this->getPaymentShortName();
     $ratepay = new pi_ratepay_xml_service();
     $ratepay->live = checkSandboxMode($payName);
     $request = $ratepay->getXMLObject();
     setRatepayHead($request, 'PAYMENT_REQUEST', $user);
     if ($payName == 'RatePAYInvoice') $content = setRatepayContent($request, 'rechnung');
     elseif ($payName == 'RatePAYDebit') $content = setRatepayContent($request, 'directDebit');
     else $content = setRatepayContent($request, 'ratenzahlung');
     $customer = $user['billingaddress']['firstname'] . ' ' . $user['billingaddress']['lastname'];
     $response = $ratepay->paymentOperation($request);
     if($payName == 'RatePAYDebit' ||($payName == 'RatePAYRate' && Shopware()->Session()->RatepayDirectDebit))
             $request = checkBankDataSave($request, $user);
     writeLog("", Shopware()->Session()->pi_ratepay_transactionID, "PAYMENT_REQUEST", "", $request, $response, $customer, $payName);
     if ($response && (string) $response->head->processing->status->attributes()->code == "OK"
         && (string) $response->head->processing->result->attributes()->code == "402"
     ) {
         Shopware()->Session()->pi_ratepay_rechnung_descriptor = (string) $response->content->payment->descriptor;
         return $this->forward('end');
     } else {
         Shopware()->Session()->pi_ratepay_no_ratepay = true;
         $sql = "SELECT `userID` FROM `s_user_billingaddress` WHERE `id` = ?";
         $userID = Shopware()->Db()->fetchOne($sql, array((int)$user['billingaddress']['userID']));
         $sql = "UPDATE `s_user` SET `paymentID` = ? WHERE `id` = ?";
         Shopware()->Db()->query($sql, array((int)Shopware()->Config()->Defaultpayment, (int)$userID));
         $this->saveStats(false);
         return $this->redirect(array('controller' => 'account', 'action' => 'payment', 'sTarget' => 'checkout', 'forceSecure' => true));
     }
 }
开发者ID:nhp,项目名称:shopware-4,代码行数:36,代码来源:ratepayFrontend.php


示例7: addEntry

 public function addEntry($data, $program)
 {
     $entry = new Entry();
     $entry->fromData($data, $program);
     array_push($this->entries, $entry);
     writeLog('Loaded entry for program ' . $program->id . ' (', $program->year . ')');
     return $entry;
 }
开发者ID:redsummit,项目名称:anitaborg,代码行数:8,代码来源:User.php


示例8: displayChunk

/**
 * 
 * @param type $file_path
 */
function displayChunk($file_path)
{
    writeLog($file_path);
    if (is_file($file_path)) {
        readfile($file_path);
    } else {
        writeLog("ERROR ! Invalid path " . $file_path);
    }
}
开发者ID:albancrommer,项目名称:raspicamlive,代码行数:13,代码来源:stream.php


示例9: check_for_configfile

function check_for_configfile()
{
    if (!file_exists(absolute_path('config.xml'))) {
        if (file_exists(absolute_path('cofig.xml-dist'))) {
            writeLog('Vor der Nutzung »config.xml-dist« in »config.xml« umbennen und anpassen.', FAIL);
            die;
        } else {
            writeLog('Konfigurationsdatei »config.xml« nicht vorhanden.', FAIL);
            die;
        }
    }
}
开发者ID:jk,项目名称:tvdl-tools,代码行数:12,代码来源:inc.functions.php


示例10: aopclient_request_execute

/**
 * 使用SDK执行接口请求
 * @param unknown $request
 * @param string $token
 * @return Ambigous <boolean, mixed>
 */
function aopclient_request_execute($request, $token = NULL)
{
    require 'config.php';
    $aop = new AopClient();
    $aop->gatewayUrl = $config['gatewayUrl'];
    $aop->appId = $config['app_id'];
    $aop->rsaPrivateKeyFilePath = $config['merchant_private_key_file'];
    $aop->apiVersion = "1.0";
    $result = $aop->execute($request, $token);
    writeLog("response: " . var_export($result, true));
    return $result;
}
开发者ID:jaydom,项目名称:weishang,代码行数:18,代码来源:function.inc.php


示例11: execute

 public function execute($query_str, $params = [])
 {
     if ($this->mysql === false) {
         return false;
     }
     $query = $this->getQuerySTR($query_str, $params);
     $this->last_query = $query;
     if (!$this->mysql->real_query($query)) {
         $this->last_error = $this->mysql->error;
         writeLog("SQL Error:\n\t" . $this->last_error . "\n\tQuery: " . $this->last_query);
         return false;
     }
     return true;
 }
开发者ID:ksanderpugin,项目名称:fiteat,代码行数:14,代码来源:sql.php


示例12: EmailErrorHandler

function EmailErrorHandler($FXErrorObj)
{
    //if error not written to log
    if (checkLog() == false) {
        //send email to admins
        EmailError($FXErrorObj->message);
    }
    //write it
    writeLog($FXErrorObj->message);
    if (DISPLAY_ERROR_MESSAGES) {
        echo $FXErrorObj->message;
    }
    return true;
}
开发者ID:pitabaki,项目名称:seminar_o_matic,代码行数:14,代码来源:FX.php


示例13: saveData

 /**
  * 保存数据进数据库
  * @param $data
  * @author Mr.Cong <[email protected]>
  */
 public function saveData($data)
 {
     DB::table('news')->truncate();
     foreach ($data['items'] as $key => $item) {
         $News = new News();
         $News->title = $item->get_title();
         $News->tag = $this->tag;
         $News->link = $item->get_link();
         $News->description = html_entity_decode($item->get_description(), ENT_COMPAT);
         $News->category = $item->get_category()->get_term();
         $News->author = $item->get_author()->get_name();
         $News->pubDate = strtotime($item->get_date());
         $News->content = html_entity_decode($item->get_content(), ENT_COMPAT);
         $News->save();
     }
     writeLog('Save data to database.');
 }
开发者ID:Cong5,项目名称:gdg-gsee,代码行数:22,代码来源:ChinagdgNews.php


示例14: readResp

 function readResp()
 {
     //freadで応答が無いと止まってしまうので非同期モードにする
     stream_set_blocking($this->pipes[1], 0);
     $read_str = fread($this->pipes[1], 8192);
     if ($read_str === FALSE) {
         $this->close(FALSE);
         $info_msg = 'ERROR:	SSH fread failed.';
         writeLog(0, "59Y", $info_msg);
         return FALSE;
     }
     if ($this->stdout) {
         //デバッグ用
         echo $read_str, "\n";
     }
     return $read_str;
 }
开发者ID:p-rex,项目名称:test,代码行数:17,代码来源:yio_lib.php


示例15: processMessage

function processMessage($msg)
{
    global $messageCounter;
    echo "Processing Message Number = {$messageCounter}. Press CTRL+C to stop processing\n";
    $messageCounter++;
    if (isset($msg)) {
        $dataArray = json_decode($msg->body, true);
        if (is_array($dataArray)) {
            writeLog($dataArray, LOG_SMS_FOR_NON_PAUSE);
            $msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
        } else {
            writeLog('Invalid JSON', LOG_PROCESS_INCOMING);
        }
    } else {
        writeLog('Invalid Message Parameter in Callback', LOG_PROCESS_INCOMING);
    }
}
开发者ID:ksaurabhsinha,项目名称:rabbitmq_sample_app,代码行数:17,代码来源:process_sms_queue.php


示例16: __construct

 function __construct()
 {
     /* we should not always load the feed ... */
     if (OpenBHConf::get('xmlfeed') == true) {
         if (!function_exists('simplexml_load_file')) {
             writeLog("SimpleXML support missing");
             return false;
         }
         $this->fmap = OpenBHConf::get('xmlfeedmapping');
     } else {
         $this->fmap = OpenBHConf::get('feedmapping');
     }
     if (!array_key_exists('keyword', $this->fmap)) {
         writeLog("Missing 'keyword' in 'feedmapping' (see config..php)");
         return false;
         // ... missing keyword mapping
     }
 }
开发者ID:jewelhuq,项目名称:OpenBH-Cash-Generator,代码行数:18,代码来源:DataFeed.php


示例17: checkCache

function checkCache($ip, $mac, $group)
{
    global $mc;
    if ($mc) {
        $key = "{$ip}||{$mac}||{$group}";
        $un = $mc->get($key);
        if ($un !== false) {
            writeLog("Retrieved from cache: {$key} => " . ($un ? $un : "NOT AUTHORISED"), true);
            if (!is_null($un)) {
                writeReply("OK user={$un}");
            } else {
                writeReply("ERR");
            }
            return true;
        }
    }
    return false;
}
开发者ID:eduridden,项目名称:extensions,代码行数:18,代码来源:external_auth.php


示例18: counter

function counter()
{
    $count_fp = fopen(COUNT_FILE, 'r+');
    // アクセス数ファイルをopen
    if (flock($count_fp, LOCK_EX)) {
        // アクセス数ファイルをLock
        $countData = fgets($count_fp);
        // アクセス数データを$countに読み込む
        $count = explode(',', $countData);
        // $countDataを,で区切って [0]日付 [1]累計 [2]今日 [3]昨日
        $count[1] += 1;
        // 累計アクセス数を1増やす
        // タイムゾーンを日本標準時に(WordPress対策)
        date_default_timezone_set('Asia/Tokyo');
        $now = date('Ymd');
        //今日の日付を8桁で取得
        date_default_timezone_set('UTC');
        if ($now === $count[0]) {
            // 日付が一致したら,今日アクセス数を1増やす
            $count[2] += 1;
        } else {
            // 日付が変わった場合
            writeLog($count[0], $count[2]);
            // ログに書き込む
            $count[3] = $count[2];
            // 今日を昨日に
            $count[2] = 1;
            // 今日をリセット
        }
        ftruncate($count_fp, 0);
        // 中身をリセット
        rewind($count_fp);
        // アクセス数ファイルのファイルポインタを先頭へ
        fwrite($count_fp, $now . ',' . $count[1] . ',' . $count[2] . ',' . $count[3]);
        // アクセス数ファイルに新たな値を書き込む
        flock($count_fp, LOCK_UN);
        // アクセス数ファイルをunLock
    }
    fclose($count_fp);
    // アクセス数ファイルをclose
    // アクセス数を json 形式にして出力
    $counts = array('total' => $count[1], 'today' => $count[2], 'yesterday' => $count[3]);
    echo json_encode($counts);
}
开发者ID:shun91,项目名称:ajax-counter,代码行数:44,代码来源:counter.php


示例19: createFeedback

/** \brief Creates new feedback to be put in the database
* \param feedback Data required to make new feedback
* \returns A json encoded 'success' array on success, null in event of error
*/
function createFeedback($feedback)
{
    try {
        require "/var/database_config.php";
        $pdo = new PDO('mysql:host=' . $db_config['host'] . ';dbname=' . $db_config['dbname'], $db_config['username'], $db_config['password']);
        $statement = $pdo->prepare("INSERT INTO feedback (interaction_id, admin_gm_id, stars, comments) VALUES (:interaction_id, :admin_gm_id, :stars, :comments)");
        $statement->bindParam(':interaction_id', $feedback['interaction_id']);
        $statement->bindParam(':admin_gm_id', $feedback['admin_gm_id']);
        $statement->bindParam(':stars', $feedback['stars']);
        $statement->bindParam(':comments', $feedback['comments']);
        $statement->execute();
        $log = array("Feedback left on ticket.");
        require "../log.php";
        writeLog($feedback['interaction_id'], $log);
        return array('status' => 'Successfully left feedback');
    } catch (PDOException $e) {
        return array('error' => 'Error leaving feedback!');
    }
}
开发者ID:GM-Team,项目名称:web,代码行数:23,代码来源:index.php


示例20: processMessage

function processMessage($msg)
{
    global $messageCounter, $objSwiftMailer;
    echo "Processing Message Number = {$messageCounter}. Press CTRL+C to stop processing\n";
    $messageCounter++;
    if (isset($msg)) {
        $dataArray = json_decode($msg->body, true);
        if (is_array($dataArray)) {
            if ($dataArray['type'] == 'email') {
                // Create a message
                $message = Swift_Message::newInstance('Sample Subject')->setFrom(array($dataArray['from']))->setTo($dataArray['recipients'])->setBody($dataArray['html'], 'multipart/alternative')->addPart($dataArray['html'], 'text/html')->addPart($dataArray['text'], 'text/plain');
                // Send the message
                $objSwiftMailer->send($message);
                //writeLog($result, LOG_FOR_EMAIL_SENT);
            } else {
                if ($dataArray['type'] = 'sms') {
                    $pauseTimeArray = getPauseTimings(PAUSE_START_TIME, PAUSE_END_TIME);
                    if (is_array($pauseTimeArray)) {
                        $pauseStartTime = strtotime($pauseTimeArray['pause_start_time']);
                        $pauseEndTime = strtotime($pauseTimeArray['pause_end_time']);
                        $presentTime = strtotime(date('Y-m-d H:i:s'));
                        if ($presentTime > $pauseStartTime && $presentTime < $pauseEndTime) {
                            global $objRabbitMQ;
                            //Add this SMS to the custom SMS queue, to be processed at the perfect time
                            $objRabbitMQ->declareQueue('sms_queue');
                            $objRabbitMQ->publish($msg->body, array('delivery_mode' => 2));
                        } else {
                            writeLog($dataArray, LOG_SMS_FOR_NON_PAUSE);
                        }
                    } else {
                        writeLog('Invalid Pause timings', LOG_PROCESS_INCOMING);
                    }
                }
            }
            $msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
        } else {
            writeLog('Invalid JSON', LOG_PROCESS_INCOMING);
        }
    } else {
        writeLog('Invalid Message Parameter in Callback', LOG_PROCESS_INCOMING);
    }
}
开发者ID:ksaurabhsinha,项目名称:rabbitmq_sample_app,代码行数:42,代码来源:process_incoming_queue.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP writeMsg函数代码示例发布时间:2022-05-23
下一篇:
PHP writeHeader函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap