當前位置: 首頁>>代碼示例>>PHP>>正文


PHP trace函數代碼示例

本文整理匯總了PHP中trace函數的典型用法代碼示例。如果您正苦於以下問題:PHP trace函數的具體用法?PHP trace怎麽用?PHP trace使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了trace函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: query_cache

function query_cache($options)
{
    global $QUERY_CACHE_CACHE;
    if (strpos('u.birthday < 1970', $options['query']) === true) {
        die('ERROR!!!');
    }
    $options['category'] = isset($options['category']) ? $options['category'] : 'other';
    $options['max_delay'] = isset($options['max_delay']) ? $options['max_delay'] : 300;
    $path = PATHS_INCLUDE . 'cache/query_cache/' . $options['category'] . '/';
    $filename = md5($options['query']) . '.phpserialized';
    if (isset($QUERY_CACHE_CACHE[$filename])) {
        return $QUERY_CACHE_CACHE[$filename];
    }
    if (!is_dir($path)) {
        mkdir($path);
    }
    if (!file_exists($path . $filename)) {
        trace('new_query_cache_' . $options['category'], $options['query']);
    }
    if (filemtime($path . $filename) < time() - $options['max_delay']) {
        $result = mysql_query($options['query']) or report_sql_error($query, __FILE__, __LINE__);
        while ($row = mysql_fetch_assoc($result)) {
            $data[] = $row;
        }
        $serialized = serialize($data);
        //trace('query_cache', 'Creating file for query: ' . $options['query']);
        file_put_contents($path . $filename, $serialized);
    } else {
        $data = unserialize(file_get_contents($path . $filename));
    }
    $QUERY_CACHE_CACHE[$filename] = $data;
    return $data;
}
開發者ID:Razze,項目名稱:hamsterpaj,代碼行數:33,代碼來源:cache.lib.php

示例2: getAllPlugins

 /**
  * Return array of all plugins based on plugin files on filesystem
  *
  * @param none
  * @return array
  */
 static function getAllPlugins()
 {
     trace(__FILE__, 'getAllPlugins()');
     $results = array();
     $dir = APPLICATION_PATH . '/plugins';
     $dirs = get_dirs($dir, false);
     foreach ((array) $dirs as $plugin) {
         if (file_exists($dir . '/' . $plugin . '/init.php') && is_file($dir . '/' . $plugin . '/init.php')) {
             $results[$plugin] = '-';
         }
     }
     // now sort by name
     ksort($results);
     // now get activated plugins
     $conditions = array('`installed` = 1');
     $plugins = Plugins::findAll(array('conditions' => $conditions));
     trace(__FILE__, 'getAllPlugins() - all plugins retrieved from database');
     foreach ((array) $plugins as $plugin) {
         trace(__FILE__, 'getAllPlugins() - foreach: ' . $plugin->getName());
         if (array_key_exists($plugin->getName(), $results)) {
             $results[$plugin->getName()] = $plugin->getPluginId();
         } else {
             // TODO : remove from DB here??
         }
     }
     return $results;
 }
開發者ID:469306621,項目名稱:Languages,代碼行數:33,代碼來源:Plugins.class.php

示例3: run

 public function run(&$_data)
 {
     $engine = strtolower(C('TMPL_ENGINE_TYPE'));
     if ('think' == $engine) {
         //[sae] 采用Think模板引擎
         if ($this->checkCache($_data['file'])) {
             // 緩存有效
             SaeMC::include_file(md5($_data['file']) . C('TMPL_CACHFILE_SUFFIX'), $_data['var']);
         } else {
             $tpl = Think::instance('ThinkTemplate');
             // 編譯並加載模板文件
             $tpl->fetch($_data['file'], $_data['var']);
         }
     } else {
         // 調用第三方模板引擎解析和輸出
         $class = 'Template' . ucwords($engine);
         if (is_file(CORE_PATH . 'Driver/Template/' . $class . '.class.php')) {
             // 內置驅動
             $path = CORE_PATH;
         } else {
             // 擴展驅動
             $path = EXTEND_PATH;
         }
         if (require_cache($path . 'Driver/Template/' . $class . '.class.php')) {
             $tpl = new $class();
             $tpl->fetch($_data['file'], $_data['var']);
         } else {
             // 類沒有定義
             throw_exception(L('_NOT_SUPPERT_') . ': ' . $class);
         }
     }
     //[sae] 添加trace信息。
     trace(array('[SAE]核心緩存' => $_SERVER['HTTP_APPVERSION'] . '/' . RUNTIME_FILE, '[SAE]模板緩存' => $_SERVER['HTTP_APPVERSION'] . '/' . md5($_data['file']) . C('TMPL_CACHFILE_SUFFIX')));
 }
開發者ID:nexteee,項目名稱:php,代碼行數:34,代碼來源:ParseTemplateBehavior.class.php

示例4: _initialize

 /**
  * 此方法是基礎控製器中定義好的初始化方法,可以做一些具體操作之前的初始化工作。
  * 我們在這裏進行標題的統一配置和數據傳輸。
  */
 public function _initialize()
 {
     trace(ACTION_NAME);
     $meta_titles = array('index' => '菜單管理', 'add' => '添加菜單', 'edit' => '修改菜單');
     $meta_title = isset($meta_titles[ACTION_NAME]) ? $meta_titles[ACTION_NAME] : '菜單管理';
     $this->assign('meta_title', $meta_title);
 }
開發者ID:kunx-edu,項目名稱:tp1030,代碼行數:11,代碼來源:MenuController.class.php

示例5: send

 public static function send($msg, $detail, $level = self::NOTIC, $mobile = null)
 {
     //判斷是否定義需要發送短信
     if (!in_array($level, explode(',', C('SMS_ALERT_LEVEL')))) {
         return;
     }
     //判斷發送頻率
     $mc = memcache_init();
     $is_send = $mc->get('think_sms_send');
     //如果已經發送,則不發送
     if ($is_send === 'true') {
         $status = 'not send';
     } else {
         $sms = apibus::init('sms');
         if (is_null($mobile)) {
             $mobile = C('SMS_ALERT_MOBILE');
         }
         $mc = memcache_init();
         $obj = $sms->send($mobile, mb_substr(C('SMS_ALERT_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_ALERT_INTERVAL'));
         }
     }
     //記錄日誌
     if (C('LOG_RECORD')) {
         trace($msg . ';detail:' . $detail . '【status:' . $status . '】', '短信發送', 'SAE', true);
     } else {
         Log::write($msg . ';detail:' . $detail . '【status:' . $status . '】', 'SEND_SMS');
     }
 }
開發者ID:lxp521125,項目名稱:TP-Admin,代碼行數:33,代碼來源:Sms.class.php

示例6: run

 public function run(&$_data)
 {
     $engine = strtolower(C('TMPL_ENGINE_TYPE'));
     $_content = empty($_data['content']) ? $_data['file'] : $_data['content'];
     $_data['prefix'] = !empty($_data['prefix']) ? $_data['prefix'] : C('TMPL_CACHE_PREFIX');
     if ('think' == $engine) {
         // 采用Think模板引擎
         if (!empty($_data['content']) && $this->checkContentCache($_data['content'], $_data['prefix']) || $this->checkCache($_data['file'], $_data['prefix'])) {
             // 緩存有效
             //[cluster]載入模版緩存文件
             ThinkFS::include_file(C('CACHE_PATH') . $_data['prefix'] . md5($_content) . C('TMPL_CACHFILE_SUFFIX'), $_data['var']);
         } else {
             $tpl = Think::instance('ThinkTemplate');
             // 編譯並加載模板文件
             $tpl->fetch($_content, $_data['var'], $_data['prefix']);
         }
     } else {
         // 調用第三方模板引擎解析和輸出
         $class = 'Template' . ucwords($engine);
         if (class_exists($class)) {
             $tpl = new $class();
             $tpl->fetch($_content, $_data['var']);
         } else {
             // 類沒有定義
             throw_exception(L('_NOT_SUPPERT_') . ': ' . $class);
         }
     }
     //[cluster] 增加有用的trace信息
     trace(RUNTIME_FILE, '核心編譯緩存KEY', 'DEBUG');
     trace(C('CACHE_PATH') . $_data['prefix'] . md5($_content) . C('TMPL_CACHFILE_SUFFIX'), '模板緩存KEY', 'DEBUG');
 }
開發者ID:xibaachao,項目名稱:1bz,代碼行數:31,代碼來源:ParseTemplateBehavior.class.php

示例7: talkpage

 public function talkpage($tid)
 {
     if (IS_POST) {
         if (I('post.type') == 'create') {
             if (D('TalkComment')->add_new($tid, I('post.content'))) {
                 $this->success('發表成功');
             } else {
                 $this->error('發表失敗');
             }
         }
     } else {
         trace('user_auth_sign', session('user_auth_sign'));
         $talk_class = M('TalkClass')->where('display=1')->order('id')->select();
         $talk_pagecon = M('Talk')->where('id=%d', $tid)->find();
         $talk_count = M('TalkComment')->where('tid=%d', $tid)->count();
         $talk_comment = M('TalkComment')->where('tid=%d', $tid)->order('id')->limit(I('get.numb'), I('get.numb') + 30)->select();
         $talk_page_numb = I('get.numb');
         $this->assign('tid', $tid);
         $this->assign('talk_class', $talk_class);
         $this->assign('talk_count', $talk_count);
         $this->assign('talk_comment', $talk_comment);
         $this->assign('talk_pagecon', $talk_pagecon);
         $this->assign('talk_page_numb', $talk_page_numb);
         $this->display();
     }
 }
開發者ID:smilecc,項目名稱:ahsxcg,代碼行數:26,代碼來源:TalkController.class.php

示例8: check_max_calls

/**
 * If max_calls has been reached on any data sources, this function will
 * report it, save local data, and exit.
 */
function check_max_calls()
{
    if ($max = max_calls()) {
        trace("Reached call limit on data source(s) (bitmask {$max}). Exiting.");
        save_and_exit();
    }
}
開發者ID:netlife,項目名稱:fatsync,代碼行數:11,代碼來源:misc.php

示例9: Gdn_ErrorHandler

/**
 *
 *
 * @param $errorNumber
 * @param $message
 * @param $file
 * @param $line
 * @param $arguments
 * @return bool|void
 * @throws Gdn_ErrorException
 */
function Gdn_ErrorHandler($errorNumber, $message, $file, $line, $arguments)
{
    $errorReporting = error_reporting();
    // Don't do anything for @supressed errors.
    if ($errorReporting === 0) {
        return;
    }
    if (($errorReporting & $errorNumber) !== $errorNumber) {
        if (function_exists('trace')) {
            trace(new \ErrorException($message, $errorNumber, $errorNumber, $file, $line), TRACE_NOTICE);
        }
        // Ignore errors that are below the current error reporting level.
        return false;
    }
    $fatalErrorBitmask = E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR;
    if ($errorNumber & $fatalErrorBitmask) {
        // Convert all fatal errors to an exception
        throw new Gdn_ErrorException($message, $errorNumber, $file, $line, $arguments);
    }
    // All other unprocessed non-fatal PHP errors are possibly Traced and logged to the PHP error log file
    $nonFatalErrorException = new \ErrorException($message, $errorNumber, $errorNumber, $file, $line);
    if (function_exists('trace')) {
        trace($nonFatalErrorException, TRACE_NOTICE);
    }
    errorLog(formatErrorException($nonFatalErrorException));
}
開發者ID:vanilla,項目名稱:vanilla,代碼行數:37,代碼來源:functions.error.php

示例10: parseLink

 public function parseLink($pUrl)
 {
     $parsers = array("AmazonFrParser" => '/^http:\\/\\/www\\.amazon\\.fr/', "LaRedouteFrParser" => '/^http:\\/\\/www\\.laredoute\\.fr/', "AsosFrParser" => '/^http:\\/\\/www\\.asos\\.fr/');
     $class = null;
     foreach ($parsers as $className => $regExp) {
         if (!preg_match($regExp, $pUrl, $matches)) {
             continue;
         }
         $class = "app\\main\\src\\data\\" . $className;
     }
     if ($class === null) {
         //Unknown shop
         return false;
     }
     $user_headers = array('User-Agent: ' . $_SERVER['HTTP_USER_AGENT'], 'Accept: ' . $_SERVER['HTTP_ACCEPT'], 'Accept-Encoding: ' . $_SERVER['HTTP_ACCEPT_ENCODING'], 'Accept-Language: ' . $_SERVER['HTTP_ACCEPT_LANGUAGE']);
     $context = stream_context_create(array('http' => array('ignore_errors' => true, 'method' => 'GET', 'header' => implode('\\r\\n', $user_headers))));
     $content = file_get_contents($pUrl, false, $context);
     if (empty($content)) {
         trace("nop empty response");
         return false;
     }
     $parsedData = $class::parse($content);
     if (empty($parsedData['canonical'])) {
         $parsedData['canonical'] = $pUrl;
     }
     if (strpos($parsedData['canonical'], 'http://') !== 0) {
         if (!preg_match('/^\\//', $parsedData['canonical'], $matches)) {
             $parsedData['canonical'] = '/' . $parsedData['canonical'];
         }
         $domain = explode('/', $pUrl);
         $parsedData['canonical'] = 'http://' . $domain[2] . $parsedData['canonical'];
     }
     return $parsedData;
 }
開發者ID:arno06,項目名稱:Savely,代碼行數:34,代碼來源:model.ModelLink.php

示例11: initUserAttributes

 /**
  * @inheritdoc
  */
 protected function initUserAttributes()
 {
     $data = [];
     foreach (explode(" ", $this->scope) as $scope) {
         if (in_array($scope, $this->_userinfoscopes)) {
             $api = $this->api($scope, 'GET');
             if (ArrayHelper::getValue($api, 'status') !== "ok") {
                 Yii:
                 trace("Server error: " . print_r($api, true));
                 throw new InvalidResponseException($api, "error", print_r($api, true));
             }
             $apiData = ArrayHelper::getValue($api, 'data', []);
             if ($scope === "profile") {
                 if (ArrayHelper::getValue($apiData, 'blacklisted') !== false || ArrayHelper::getValue($apiData, 'quarantine') !== false || ArrayHelper::getValue($apiData, 'verified') !== true) {
                     Yii::trace("OAuth Failed. Provider V. Data: " . print_r($api, true), 'oauth');
                     throw new UserNotAllowedException("User is blacklisted, quarantined or not verified");
                 }
                 if (ArrayHelper::keyExists('enlid', $apiData)) {
                     if (ArrayHelper::getValue($apiData, 'enlid') === "null") {
                         Yii:
                         trace("enlid is null", 'oauth');
                         throw new UserNotAllowedException("Userprofile incomplete");
                     } else {
                         $data['id'] = ArrayHelper::getValue($data, 'enlid');
                     }
                 }
             }
             $data = array_merge($data, $apiData);
         }
     }
     return $data;
 }
開發者ID:aradiv,項目名稱:yii2-authclient-v,代碼行數:35,代碼來源:VOAuth.php

示例12: keyword

 public function keyword($params)
 {
     if ($params['mp_id']) {
         $kmap['mp_id'] = $params['mp_id'];
         $kmap['keyword'] = $params['weObj']->getRevContent();
         //TODO:先隻支持精確匹配,後續根據keyword_type字段增加模糊匹配
         $Keyword = M('Keyword')->where($kmap)->find();
         if ($Keyword['model'] && $Keyword['aim_id']) {
             //如果有指定模型,就用模型中的aim_id數據組裝回複的內容
             $amap['id'] = $Keyword['aim_id'];
             $aimData = M($Keyword['model'])->where($amap)->find();
             $reData[0]['Title'] = $aimData['title'];
             $reData[0]['Description'] = $aimData['intro'];
             $reData[0]['PicUrl'] = get_cover_url($aimData['cover']);
             //'http://images.domain.com/templates/domaincom/logo.png';
             $reData[0]['Url'] = $aimData['url'];
             trace('wechat:keyword' . get_cover_url($aimData['cover']), '微信', 'DEBUG', true);
             $params['weObj']->news($reData);
         } elseif ($Keyword['addon']) {
             //TODO:沒有指定模型,就用addon的配置信息組裝回複的內容
             $amap['name'] = $Keyword['addon'];
             $aimData = M('Addons')->where($amap)->find();
             //插件信息組裝回複,當然插件需要先安裝了
             $reData[0]['Title'] = $aimData['title'];
             $reData[0]['Description'] = $aimData['description'];
             $reData[0]['PicUrl'] = get_addoncover_url($Keyword['addon']);
             //插件目錄下放個回複封麵圖片例如jssdk插件中的cover.png
             $param['mp_id'] = $params['mp_id'];
             $reData[0]['Url'] = get_addonreply_url($Keyword['addon'], $param);
             $params['weObj']->news($reData);
         }
     } else {
     }
     // $params['weObj']->text("hello ");
 }
開發者ID:suhanyujie,項目名稱:digitalOceanVps,代碼行數:35,代碼來源:KeywordAddon.class.php

示例13: _start_challenge

function _start_challenge($stationTag = null)
{
    if ($stationTag === null) {
        rest_sendBadRequestResponse(400, "missing station Tag");
        // doesn't return
    }
    $station = Station::getFromTag($stationTag);
    if ($station === false) {
        rest_sendBadRequestResponse(404, "can find station stationTag=" . $stationTag);
        // doesn't return
    }
    $stationType = new StationType($station->get('typeId'), -1);
    if ($stationType === false) {
        trace("can't find station type stationTag = " . $stationTag, __FILE__, __LINE__, __METHOD__);
        rest_sendBadRequestResponse(500, "can't find station type stationTag=" . $stationTag);
    }
    $json = json_getObjectFromRequest("POST");
    json_checkMembers("team_id,message", $json);
    $teamPIN = $json['team_id'];
    $team = Team::getFromPin($teamPIN);
    if ($team === false) {
        trace("_start_challenge can't find team teamPin=" . $teamPIN, __FILE__, __LINE__, __METHOD__);
        rest_sendBadRequestResponse(404, "team not found PIN=" . $teamPIN);
        // doesn't return
    }
    try {
        $xxxData = XXXData::factory($stationType->get('typeCode'));
        $msg = $xxxData->startChallenge($team, $station, $stationType);
        json_sendObject(array('message' => $msg));
    } catch (InternalError $ie) {
        rest_sendBadRequestResponse($ie->getCode(), $ie->getMessage());
    }
}
開發者ID:brata-hsdc,項目名稱:brata.masterserver,代碼行數:33,代碼來源:start_challenge.php

示例14: _initialize

 /**
  * 此方法是基礎控製器中定義好的初始化方法,可以做一些具體操作之前的初始化工作。
  * 我們在這裏進行標題的統一配置和數據傳輸。
  */
 protected function _initialize()
 {
     trace(ACTION_NAME);
     $meta_titles = array('index' => '管理員管理', 'add' => '添加管理員', 'edit' => '修改管理員');
     $meta_title = isset($meta_titles[ACTION_NAME]) ? $meta_titles[ACTION_NAME] : '管理員管理';
     $this->assign('meta_title', $meta_title);
 }
開發者ID:kunx-edu,項目名稱:tp1030,代碼行數:11,代碼來源:AdminController.class.php

示例15: debugfn

function debugfn($s)
{
    global $DEBUG_CALLS;
    if ($DEBUG_CALLS) {
        trace("-- Call to function '" . $s . "' -----------------------------------------------");
    }
}
開發者ID:dxyuniesky,項目名稱:openerp-extra-6.1,代碼行數:7,代碼來源:openerp2vm.php


注:本文中的trace函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。