当前位置: 首页>>代码示例>>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;未经允许,请勿转载。