当前位置: 首页>>代码示例>>PHP>>正文


PHP logger::debug方法代码示例

本文整理汇总了PHP中logger::debug方法的典型用法代码示例。如果您正苦于以下问题:PHP logger::debug方法的具体用法?PHP logger::debug怎么用?PHP logger::debug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在logger的用法示例。


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

示例1: send

 /**
  * send
  * 必有方法,发送时调用.
  *
  * config参数为getOptions取得的所有项的配置结果
  *
  * @param mixed $target ['email']
  * @param mixed $title
  * @param mixed $config
  */
 public function send($target, $title, $content, $config)
 {
     logger::debug(__CLASS__ . var_export(func_get_args(), 1));
     $new_msg = array('member_id' => $target['member_id'], 'target' => $target['email'], 'subject' => $title, 'content' => $content, 'createtime' => time(), 'msg_type' => 'email', 'status' => 'sent');
     app::get('b2c')->model('member_msg')->save($new_msg);
     if (!($email_to = $target['email'])) {
         return false;
     }
     if ($config['sendway'] == 'mail') {
         $this->email = vmc::singleton('desktop_email_email');
     }
     $this->email->Sender = $this->Sender = $config['usermail'];
     $this->email->Subject = $this->Subject = $this->email->inlineCode($title);
     $From = $this->email->inlineCode(app::get('site')->getConf('site_name')) . '<' . $config['usermail'] . '>';
     $header = array('Return-path' => '<' . $config['usermail'] . '>', 'Date' => date('r'), 'From' => $From, 'MIME-Version' => '1.0', 'Subject' => $this->Subject, 'To' => $email_to, 'Content-Type' => 'text/html; charset=UTF-8; format=flowed', 'Content-Transfer-Encoding' => 'base64');
     $body = chunk_split(base64_encode($content));
     $header = $this->email->buildHeader($header);
     $config['sendway'] = $config['sendway'] ? $config['sendway'] : 'smtp';
     switch ($config['sendway']) {
         case 'sendmail':
             $result = $this->email->SendmailSend($email_to, $header, $body);
             break;
         case 'mail':
             $result = $this->email->MailSend($email_to, $header, $body);
             break;
         case 'smtp':
             $result = $this->email->SmtpSend($email_to, $header, $body, $config);
             break;
         default:
             $result = false;
             break;
     }
     return $result;
 }
开发者ID:yindonghai,项目名称:msk.com,代码行数:44,代码来源:email.php

示例2: exec

 /**
  * 订单创建完成时
  * @params array - 订单完整数据,含ITEMS
  * @return boolean - 执行成功与否
  */
 public function exec($sdf, &$msg = '')
 {
     logger::debug($sdf['order_id'] . 'createfinish exec');
     if ($sdf['is_cod'] == 'Y') {
         $freeze_data = array();
         foreach ($sdf['items'] as $key => $item) {
             //购买数量计数
             vmc::singleton('b2c_openapi_goods', false)->counter(array('goods_id' => $item['goods_id'], 'buy_count' => $item['nums'], 'buy_count_sign' => md5($item['goods_id'] . 'buy_count' . $item['nums'] * 1024)));
             //组织库存冻结数据
             $freeze_data[] = array('sku' => $item['bn'], 'quantity' => $item['nums']);
         }
         //库存冻结
         if (!vmc::singleton('b2c_goods_stock')->freeze($freeze_data, $msg)) {
             logger::error('库存冻结异常!ORDER_ID:' . $sdf['order_id'] . ',' . $msg);
         }
     }
     /* 订单金额为0 **/
     $order_sdf = $sdf;
     if ($order_sdf['order_total'] == '0') {
         // 生成支付账单
         $obj_bill = vmc::singleton('ectools_bill');
         $bill_sdf = array('bill_type' => 'payment', 'pay_object' => 'order', 'pay_mode' => in_array($order_sdf['pay_app'], array('-1', 'cod', 'offline')) ? 'offline' : 'online', 'order_id' => $order_sdf['order_id'], 'pay_app_id' => $order_sdf['pay_app'], 'pay_fee' => $order_sdf['cost_payment'], 'member_id' => $order_sdf['member_id'], 'status' => 'succ', 'money' => $order_sdf['order_total'], 'memo' => '订单0元时自动生成');
         if (!$obj_bill->generate($bill_sdf, $msg)) {
             //TODO 自动支付失败,
             logger::error('订单0元时自动支付失败!' . $msg);
             return;
         }
     }
     return true;
 }
开发者ID:yindonghai,项目名称:msk.com,代码行数:35,代码来源:createfinish.php

示例3: dispatch

 function dispatch($query)
 {
     // 目录遍历漏洞过滤
     $this->check_get($_GET);
     $_GET['ctl'] = $_GET['ctl'] ? $_GET['ctl'] : 'default';
     $_GET['act'] = $_GET['act'] ? $_GET['act'] : 'index';
     $_GET['app'] = $_GET['app'] ? $_GET['app'] : 'desktop';
     logger::debug(sprintf('Desktop access: "app:%s ctl:%s, act:%s"', $_GET['app'], $_GET['ctl'], $_GET['act']));
     $query_args = $_GET['p'];
     $controller = app::get($_GET['app'])->controller($_GET['ctl']);
     $server = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
     if (app::get('desktop')->getConf('use_ssl') && $_SERVER['SERVER_PORT'] == '80') {
         header("Location:https://" . $server . ':443' . $_SERVER['REQUEST_URI']);
         exit;
     } elseif (!app::get('desktop')->getConf('use_ssl') && $_SERVER['SERVER_PORT'] == '443') {
         header("Location:http://" . $server . $_SERVER['REQUEST_URI']);
         exit;
     }
     $arrMethods = get_class_methods($controller);
     if (in_array($_GET['act'], $arrMethods)) {
         call_user_func_array(array(&$controller, $_GET['act']), (array) $query_args);
     } else {
         call_user_func_array(array(&$controller, 'index'), (array) $query_args);
     }
 }
开发者ID:sss201413,项目名称:ecstore,代码行数:25,代码来源:router.php

示例4: sitemapAction

 public function sitemapAction()
 {
     $this->removeViewRenderer();
     $sitemapFile = $this->_getParam("sitemap");
     if (strpos($sitemapFile, '/') !== FALSE) {
         // / not allowed since site map file name is generated from domain name
         throw new Exception(get_class($this) . ": Attempted access to invalid sitemap [ {$sitemapFile} ]");
     }
     header("Content-type: application/xml");
     $requestedSitemap = PIMCORE_WEBSITE_PATH . "/var/search/sitemap/" . $sitemapFile;
     $indexSitemap = PIMCORE_WEBSITE_PATH . "/var/search/sitemap/sitemap.xml";
     if ($this->_getParam("sitemap") and is_file($requestedSitemap)) {
         $content = file_get_contents($requestedSitemap);
         //TODO: strlen($content) takes a few seconds!
         //header("Content-Length: ".strlen($content));
         echo $content;
         exit;
     } else {
         if (is_file($indexSitemap)) {
             $content = file_get_contents($indexSitemap);
             //TODO: strlen($content) takes a few seconds!
             //header("Content-Length: ".strlen($content));
             echo $content;
             exit;
         } else {
             logger::debug(get_class($this) . ": sitemap request - but no sitemap available to deliver");
             exit;
         }
     }
 }
开发者ID:weblizards-gmbh,项目名称:search-php,代码行数:30,代码来源:FrontendController.php

示例5: send

 public function send($target, $title, $content, $config)
 {
     $tmpl_data = $config['tmpl_data'];
     $action_name = $config['action_name'];
     $action_name_alias = $config['action_name_alias'];
     $new_msg = array('member_id' => $target['member_id'], 'target' => $target['mobile'], 'subject' => $title, 'content' => $content . $this->platform_config['sms_sign'], 'createtime' => time(), 'msg_type' => 'sms', 'status' => 'sent');
     app::get('b2c')->model('member_msg')->save($new_msg);
     if (!$target['mobile']) {
         return false;
     }
     if (empty($this->platform_config['url']) || empty($this->platform_config['params_tmpl'])) {
         return false;
     }
     $args = array('target' => $target['mobile'], 'content' => $content . $this->platform_config['sms_sign'], 'tmpl_data' => json_encode($tmpl_data), 'time' => date('Y-m-d H:i:s'), 'action' => $action_name, 'action_alias' => $action_name_alias);
     //需要获得access_token
     if (!empty($this->platform_config['access_token_action'])) {
         if (!($args['access_token'] = $this->get_access_token($this->platform_config['access_token_action']))) {
             logger::error($this->platform_config['name'] . 'access_token获得失败,无法调用短信发送API');
             return false;
         }
     }
     $params = $this->gen_params($this->platform_config['params_tmpl'], $args);
     $result = $this->net->post($this->platform_config['url'], $params);
     logger::debug(__CLASS__ . $this->platform_config['url']);
     logger::debug(var_export($params, 1));
     logger::debug(var_export($result, 1));
     return true;
 }
开发者ID:yindonghai,项目名称:msk.com,代码行数:28,代码来源:sms.php

示例6: exec

 /**
  * 订单发货操作完成时.
  *
  * @delivery_sdf array - 发货单据SDF
  * @msg  异常消息
  *
  * @return bool - 执行成功与否
  */
 public function exec($delivery_sdf, &$msg = '')
 {
     $order_id = $delivery_sdf['order_id'];
     if (!$order_id) {
         $msg = '未知订单id';
         return false;
     }
     $all_send = true;
     $order_items = app::get('b2c')->model('order_items')->getList('*', array('order_id' => $order_id));
     $order_items = utils::array_change_key($order_items, 'item_id');
     foreach ($delivery_sdf['delivery_items'] as $item) {
         $order_items[$item['order_item_id']]['sendnum'] += $item['sendnum'];
         if ($order_items[$item['order_item_id']]['sendnum'] > $order_items[$item['order_item_id']]['nums']) {
             $msg = '发货异常,超出应发数量';
             return false;
         }
         if ($order_items[$item['order_item_id']]['sendnum'] < $order_items[$item['order_item_id']]['nums']) {
             $all_send = false;
             //部分发货
         }
     }
     $order_sdf = array('order_id' => $order_id, 'items' => $order_items, 'ship_status' => $all_send ? '1' : '2');
     if (!app::get('b2c')->model('orders')->save($order_sdf)) {
         $msg = '订单状态修改失败!';
         return false;
     }
     //库存冻结释放,真实扣除库存
     $stock_data = array();
     foreach ($delivery_sdf['delivery_items'] as $key => $value) {
         $stock_data[] = array('sku' => $value['bn'], 'quantity' => $value['sendnum']);
     }
     if (!vmc::singleton('b2c_goods_stock')->unfreeze($stock_data, $msg)) {
         logger::error('库存冻结释放异常!ORDER_ID:' . $order_sdf['order_id'] . ',' . $msg);
     }
     if (!vmc::singleton('b2c_goods_stock')->delivery($stock_data, $msg)) {
         logger::error('库存扣减异常!ORDER_ID:' . $order_sdf['order_id'] . ',' . $msg);
     }
     //订单日志记录
     vmc::singleton('b2c_order_log')->set_operator(array('ident' => $delivery_sdf['op_id'], 'model' => 'shopadmin', 'name' => '操作员'))->set_order_id($order_sdf['order_id'])->success('shipment', '订单' . (!$all_send ? '部分' : '') . '发货成功!', $delivery_sdf);
     /*
      * 消息通知
      * @args1 事件名称
      * @args2 消息模板数据填充
      * @args3 消息目标
      */
     $pam_data = vmc::singleton('b2c_user_object')->get_pam_data('*', $delivery_sdf['member_id']);
     logger::debug('pam_data' . var_export($pam_data, 1));
     $dlycorp = app::get('b2c')->model('dlycorp')->dump($delivery_sdf['dlycorp_id']);
     $consignee_area = $delivery_sdf['consignee']['area'];
     $consignee_area = explode(':', $consignee_area);
     $consignee_area = $consignee_area[1];
     //消息模板参数
     $env_list = array('order_id' => $delivery_sdf['order_id'], 'consignee_name' => $delivery_sdf['consignee']['name'], 'consignee_area' => $consignee_area, 'consignee_addr' => $delivery_sdf['consignee']['addr'], 'consignee_tel' => $delivery_sdf['consignee']['tel'], 'consignee_mobile' => $delivery_sdf['consignee']['mobile'], 'dlycorp_name' => $dlycorp['name'], 'dlycorp_code' => $dlycorp['corp_code'], 'dlycorp_website' => $dlycorp['website'], 'logistics_no' => $delivery_sdf['logistics_no'], 'timestr' => date('Y-m-d H:i:s', $delivery_sdf['last_modify']));
     vmc::singleton('b2c_messenger_stage')->trigger('orders-shipping', $env_list, array('mobile' => $pam_data['mobile'] ? $pam_data['mobile']['login_account'] : $order_sdf['consignee']['mobile'], 'email' => $pam_data['email'] ? $pam_data['email']['login_account'] : $order_sdf['consignee']['email'], 'member_id' => $delivery_sdf['member_id']));
     return true;
 }
开发者ID:yindonghai,项目名称:msk.com,代码行数:64,代码来源:sendfinish.php

示例7: __autoload

function __autoload($class_name)
{
    if (file_exists(FS_CLASS . $class_name . ".php")) {
        logger::debug("__autoload: file '" . FS_CLASS . $class_name . ".php" . "' exists. Loading.");
        include_once FS_CLASS . $class_name . ".php";
    } else {
        logger::debug(FS_CLASS . $class_name . ".php" . "' doesn't exists.");
        $class = "class " . $class_name . " {};";
        eval($class);
    }
}
开发者ID:bushvin,项目名称:wingman,代码行数:11,代码来源:autoload.php

示例8: __construct

 function __construct($url, $args = null)
 {
     $this->args = arr::apply(array('returndom' => false, 'method' => 'get', 'useragent' => config::get(self::KEY_USERAGENT, 'LeptonPHP/1.0 (+http://labs.noccy.com)')), (array) $args);
     $this->url = $url;
     logger::debug('HTTPRequest() query for "%s"', $url);
     if (function_exists('curl_init')) {
         $this->_curlDoRequest();
     } else {
         $this->_streamDoRequest();
     }
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:11,代码来源:httprequest.php

示例9: resource

 function resource($params = null)
 {
     if ($app = $params['app']) {
         $app = app::get($app);
         $path = isset($params['path']) && is_string($params['path']) ? $params['path'] : '';
         $url = $app->res_url . '/' . trim($path, '/');
         logger::debug($url);
         return $url;
     }
     return kernel::base_url(1);
 }
开发者ID:453111208,项目名称:bbc,代码行数:11,代码来源:ui.php

示例10: exec

 public function exec($sql, $skipModifiedMark = false, $db_lnk = null)
 {
     if ($this->prefix != 'sdb_') {
         //$sql = preg_replace('/([`\s\(,])(sdb_)([a-z\_]+)([`\s\.]{0,1})/is',"\${1}".$this->prefix."\\3\\4",$sql);
         $sql = preg_replace_callback('/([`\\s\\(,])(sdb_)([0-9a-z\\_]+)([`\\s\\.]{0,1})/is', array($this, 'fix_dbprefix'), $sql);
         //todo: 兼容有特殊符号的表名前缀
     }
     if (!$skipModifiedMark && cachemgr::enable() && preg_match('/(?:(delete\\s+from)|(insert\\s+into)|(update))\\s+([]0-9a-z_:"`.@[-]*)/is', $sql, $match)) {
         $table = strtoupper(trim(str_replace('`', '', str_replace('"', '', str_replace("'", '', $match[4])))));
         $now = time();
         $pos = strpos($table, strtoupper($this->prefix));
         if ($pos === 0) {
             $table = substr($table, strlen($this->prefix));
         }
         //todo: 真实表名
         $this->exec('UPDATE sdb_base_cache_expires SET expire = "' . $now . '" WHERE type = "DB" AND name = "' . $table . '"', true);
         if ($this->affect_row()) {
             cachemgr::set_modified('DB', $table, $now);
         }
     }
     if (!is_resource($db_lnk)) {
         if ($this->_rw_lnk) {
             $db_lnk = $this->_rw_lnk;
         } else {
             $db_lnk = $this->_rw_conn();
         }
     }
     if (defined("STRESS_TESTING")) {
         b2c_forStressTest::$sqlAmount++;
         b2c_forStressTest::slowSqlStart();
     }
     if ($rs = mysql_query($sql, $db_lnk)) {
         if (defined("STRESS_TESTING")) {
             b2c_forStressTest::slowSqlEnd($sql);
         }
         self::$mysql_query_executions++;
         logger::debug('sql:' . self::$mysql_query_executions . '.' . $sql);
         $db_result = array('rs' => $rs, 'sql' => $sql);
         return $db_result;
     } else {
         logger::error($sql . ':' . mysql_error($db_lnk));
         trigger_error($sql . ':' . mysql_error($db_lnk), E_USER_WARNING);
         return false;
     }
 }
开发者ID:sss201413,项目名称:ecstore,代码行数:45,代码来源:connections.php

示例11: exec

 /**
  * 订单创建完成时
  * @params array - 订单完整数据,含ITEMS
  * @return boolean - 执行成功与否
  */
 public function exec($sdf, &$msg = '')
 {
     logger::debug($sdf['order_id'] . 'createfinish exec');
     if ($sdf['is_cod'] == 'Y') {
         $freeze_data = array();
         foreach ($sdf['items'] as $key => $item) {
             //购买数量计数
             vmc::singleton('b2c_openapi_goods', false)->counter(array('goods_id' => $item['goods_id'], 'buy_count' => $item['nums'], 'buy_count_sign' => md5($item['goods_id'] . 'buy_count' . $item['nums'] * 1024)));
             //组织库存冻结数据
             $freeze_data[] = array('sku' => $item['bn'], 'quantity' => $item['nums']);
         }
         //库存冻结
         if (!vmc::singleton('b2c_goods_stock')->freeze($freeze_data, $msg)) {
             logger::error('库存冻结异常!ORDER_ID:' . $order_sdf['order_id'] . ',' . $msg);
         }
     }
     return true;
 }
开发者ID:noikiy,项目名称:snk,代码行数:23,代码来源:createfinish.php

示例12: query

 public function query($query = null, $debug = false)
 {
     if ($this->_dbo == null) {
         logger::error("dbo::query: A connection needs to be made with the db server first!");
         exit("Error: A connection needs to be made with the db server first!");
     }
     if ($query === null && $this->_query != "") {
         $query = $this->_query;
     } elseif ($query === null) {
         if ($this->_debug || $debug) {
             logger::warning("dbo::query: No SQL query was provided to execute.");
         }
         return false;
     }
     $this->_query = $query;
     $query = str_replace("##_", $this->_prefix, $query);
     logger::debug("dbo::query: query: {$query}");
     $this->_record_set = $this->_dbo->query($query);
     if ($this->_dbo->errno != 0) {
         logger::error("dbo::query: An error occured executing the query.");
         logger::error("The error is: '" . $this->_dbo->error . "'");
         exit("Error: The query failed. {$query}");
     }
     $this->result_count = $this->_dbo->affected_rows;
     if ($this->_dbo->errno != 0) {
         logger::error("dbo::query: An error occured calculating the number of results.");
         logger::error("The error is: '" . $this->_dbo->error . "'");
         exit("Error: Couldn't count the number of records.");
     }
     $this->fields = array();
     if (strtoupper(substr($query, 0, 6)) == "SELECT") {
         $temp = $this->_record_set->fetch_fields();
         foreach ($temp as $t) {
             $this->fields[] = $t->name;
         }
         if ($this->_dbo->errno != 0) {
             logger::error("dbo::query: An error occured fetching the fields of the result.");
             logger::error("The error is: '" . $this->_dbo->error . "'");
             exit("Error: Couldn't fetch the fields.");
         }
     }
     return $this->_record_set;
 }
开发者ID:bushvin,项目名称:wingman,代码行数:43,代码来源:dbo.mysql.php

示例13: __construct

 /**
  *
  * @param string $group The database group to connect to or the config array
  */
 public function __construct($connectionstring = null)
 {
     if ($connectionstring == null) {
         $connectionstring = 'default';
     }
     if (is_a($connectionstring, 'DatabaseDriver')) {
         $this->conn = $connectionstring;
         logger::debug('%s: Reusing connection...', __CLASS__);
         return;
     }
     if (is_array($connectionstring)) {
         $config = $connectionstring;
         logger::debug("%s: Initializing connection with %s.", __CLASS__, $connectionstring['driver']);
     } else {
         $config = config::get('lepton.db.' . $connectionstring);
         Console::debugEx("%s: Initializing connection for %s.", __CLASS__, $connectionstring);
     }
     $this->conn = DatabaseConnectionPool::getPooledConnection($config);
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:23,代码来源:databaseconnection.php

示例14: getway_callback

 public function getway_callback($pay)
 {
     $mdl_bills = $this->app->model('bills');
     $obj_bill = vmc::singleton('ectools_bill');
     $params = vmc::singleton('base_component_request')->get_params(true);
     $pay_app_class = key($pay);
     if (!stripos($pay_app_class, '_')) {
         //兼容处理
         $pay_app_class = 'ectools_payment_applications_' . $pay_app_class;
     }
     $pay_app_method = current($pay);
     $pay_app_instance = new $pay_app_class();
     if ($pay_app_class == 'wechat_payment_applications_wxpay') {
         /**
          * 微信支付特殊处理
          */
         $params['_http_raw_post_data_'] = $GLOBALS["HTTP_RAW_POST_DATA"];
     }
     $pay_result = $pay_app_instance->{$pay_app_method}($params);
     logger::debug('支付网关回调params:' . var_export($params, 1) . "\n" . $pay_app_class . "\n" . $pay_app_method . "\n" . var_export($pay_result, 1));
     if (!$pay_result || empty($pay_result['status'])) {
         $pay_result['status'] = 'error';
     }
     if ($pay_result['bill_id'] && ($bill = $mdl_bills->dump($pay_result['bill_id']))) {
         $pay_result = array_merge($bill, $pay_result);
         //update bill
         if (!$obj_bill->generate($pay_result, $msg)) {
             logger::error('支付网关回调后,更新或保存支付单据失败!' . $msg . '.bill_export:' . var_export($pay_result, 1));
         }
     }
     // Redirect page.
     if ($pay_app_method != 'notify' && $pay_result['return_url']) {
         //for ecmobilecenter
         if (preg_match('/^http([^:]*):\\/\\//', $pay_result['return_url'])) {
             header('Location: ' . $pay_result['return_url']);
         } else {
             header('Location: ' . strtolower(vmc::request()->get_schema() . '://' . vmc::request()->get_host()) . $pay_result['return_url']);
         }
     }
 }
开发者ID:yindonghai,项目名称:msk.com,代码行数:40,代码来源:api.php

示例15: dispatch

 public function dispatch($query)
 {
     $this->check_blacklist();
     //黑名单检测
     $page_starttime = $this->microtime_float();
     $this->init_query_info($query);
     $this->init_request_info();
     $this->check_https();
     $this->check_expanded_name();
     $router_cache_options = $this->check_router_cache();
     $page_key = 'SITE_PAGE_CACHE:' . $this->_request->get_request_uri();
     if (!$this->is_need_cache() || $this->is_need_cache() && !cachemgr::get($page_key, $page, $router_cache_options['skipvary'])) {
         $cache_log = 'cache missed on ' . date('Y-m-d H:i:s');
         logger::info($cache_log . ',URL:' . $this->_request->get_request_uri());
         $this->_response->set_header('X-Page-Cache', $cache_log, true);
         cachemgr::co_start();
         $this->default_dispatch();
         //执行控制器
         $page['html'] = implode("\n", $this->_response->get_bodys());
         $page['date'] = date('Y-m-d H:i:s');
         $page['times'] = sprintf('%0.2f', $this->microtime_float() - $page_starttime);
         if ($this->is_need_cache() && $this->_response->get_http_response_code() == 200 && $this->has_page_cache_control() === true) {
             $page_cache = true;
             $cache_log = 'cache refreshed on ' . $page['date'] . ',page speed:' . $page['times'];
             //logger::info($cache_log.',URL:'. $this->_request->get_request_uri());
             $this->_response->set_header('X-Page-Cache', $cache_log, true);
             $page['headers'] = $this->_response->get_headers();
             $page['raw_headers'] = $this->_response->get_raw_headers();
             $page['etag'] = md5($page['html']);
             $cache_options = cachemgr::co_end();
             if ($router_cache_options['expires']) {
                 $cache_options['expires'] = $cache_options['expires'] && $cache_options['expires'] < $router_cache_options['expires'] ? $cache_options['expires'] : $router_cache_options['expires'];
             }
             $cache_options['expires'] = $cache_options['expires'] > time() ? $cache_options['expires'] : 0;
             cachemgr::set($page_key, $page, $cache_options);
         } else {
             $page_cache = false;
             cachemgr::co_end();
         }
     } else {
         $page_cache = true;
         $this->_response->clean_headers();
         if (isset($page['headers'])) {
             foreach ($page['headers'] as $header) {
                 $this->_response->set_header($header['name'], $header['value'], $header['replace']);
             }
         }
         if (isset($page['raw_headers'])) {
             foreach ($page['raw_headers'] as $raw_header) {
                 $this->_response->set_raw_headers($raw_header);
             }
         }
         $cache_log = 'cache hit on ' . $page['date'] . ',page speed:' . $page['times'];
         //logger::info($cache_log.',URL:'. $this->_request->get_request_uri());
         $this->_response->set_header('X-Page-Cache', $cache_log, true);
     }
     if ($page_cache === true) {
         $etag = $page['etag'] ? $page['etag'] : md5($page['html']);
         //todo: 兼容
         $this->_response->set_header('Etag', $etag);
         $matchs = explode(',', $_ENV['HTTP_IF_NONE_MATCH']);
         foreach ($matchs as $match) {
             if (trim($match) == $etag) {
                 $this->_response->clean_headers();
                 $this->_response->set_header('Content-length', '0');
                 $this->_response->set_http_response_code(304)->send_headers();
                 exit;
             }
         }
     }
     $this->set_vary_cookie();
     $this->_response->send_headers();
     echo $page['html'];
     logger::debug('This page created by ' . $page['date']);
     logger::debug('Kvstore queries count:' . base_kvstore::$__fetch_count);
     logger::debug('Page speed: ' . $page['times']);
 }
开发者ID:noikiy,项目名称:snk,代码行数:77,代码来源:router.php


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