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


PHP log::returnLog方法代码示例

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


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

示例1: delete

 /**
  * 刪除 cache 資料
  * @access	public
  * @return	boolean
  * @since	2011-09-05
  */
 public function delete($key)
 {
     if ($key == '') {
         log::errorLog('$key is empty');
         return false;
     }
     if (!$this->_memcache->delete($key, 0)) {
         log::errorLog('memcacheLayer delete() failed');
         return false;
     }
     log::accessLog('memcacheLayer delete() successful');
     log::returnLog(true);
     return true;
 }
开发者ID:sajawa,项目名称:lib,代码行数:20,代码来源:memcache.php

示例2: loadDbConfig

 /**
  * load config from db
  * @access public
  * @static
  * @return boolean
  * @example
  * <p>
  * config::loadDbConfig();
  * </p>
  */
 public static function loadDbConfig()
 {
     $cacheConfig = self::get('cache');
     if ($cacheConfig) {
         //从cache中读取dbConfig,如中没有命中,则继续从DB中读取
         cacheLayer::setConfig($cacheConfig);
         $dbConfigCacheKey = cacheLayer::getKey('co', 'platform', 'config', 'loadDbConfig');
         $dbConfig = cacheLayer::read($dbConfigCacheKey);
         if ($dbConfig) {
             self::$_config = array_merge_recursive(self::$_config, $dbConfig);
             log::accessLog('Execute loadDbConfig() successful(from cache)');
             log::returnLog(true);
             return true;
         }
     }
     $mongoConfig = self::get('database.default.params');
     if (is_array($mongoConfig) && count($mongoConfig)) {
         //从mongo Db中读取config
         $accessMongo = new accessMongo($mongoConfig);
         $accessMongo->connect();
         $dbo = $accessMongo->getDb();
         $connection = $dbo->selectCollection('sg_configuration');
         $configures = iterator_to_array($connection->find(array('published' => 1), array('name', 'value', 'default_value')));
         $config = array();
         foreach ($configures as $configure) {
             if (is_numeric($configure['default_value'])) {
                 if (!is_numeric($configure['value'])) {
                     $config[$configure['name']] = $configure['default_value'];
                 } else {
                     $config[$configure['name']] = $configure['value'];
                 }
             } else {
                 if (empty($configure['value'])) {
                     $config[$configure['name']] = $configure['default_value'];
                 } else {
                     $config[$configure['name']] = $configure['value'];
                 }
             }
         }
         if (isset($dbConfigCacheKey)) {
             cacheLayer::write($dbConfigCacheKey, $config);
         }
         self::$_config = array_merge_recursive(self::$_config, $config);
         log::accessLog('Execute loadDbConfig() successful(from mongo db)');
         log::returnLog(true);
         return true;
     } else {
         log::errorLog('mongo config error');
         return false;
     }
 }
开发者ID:sajawa,项目名称:lib,代码行数:61,代码来源:config.php

示例3: findCol

 /**
  * 取得資料表裡的其中一個欄位的所有內容.
  * @access public
  * @link find()
  * @return array
  * @example  $obj->findCol() ;
  */
 public function findCol($table, $field, $conditions = null, $limit = null, $limitStart = 0, $sorts = null)
 {
     if (!$field) {
         log::errorLog('$field is empty');
         return false;
     }
     $colArr = array();
     $arr = $this->find($table, $field, $conditions, $limit, $limitStart, $sorts);
     if ($arr === false) {
         log::errorLog('execute $this->find() fail');
         return false;
     } else {
         foreach ($arr as $ak => $av) {
             $colArr[] = $av[$field];
         }
     }
     log::accessLog('execute findCol success');
     log::returnLog($colArr);
     return $colArr;
 }
开发者ID:sajawa,项目名称:lib,代码行数:27,代码来源:abstract.php

示例4: delete

 /**
  * 刪除 cache 資料
  * @access	public
  * @return	string
  * @since	2011-09-08
  */
 public function delete($key)
 {
     if (!$key) {
         log::errorLog('$key is empty');
         return false;
     }
     //convert key to file. sha1 has 1/2^51 collision possibility.
     $fileSeed = sha1($key);
     $dir1 = substr($fileSeed, 0, 2);
     $dir2 = substr($fileSeed, 2, 2);
     $cacheFile = $this->_cacheFileTopDirectory . "{$dir1}/{$dir2}/{$fileSeed}";
     $cacheExpirationFile = "{$cacheFile}_expirationTime";
     if (!file_exists($cacheFile)) {
         return false;
     }
     if (unlink($cacheFile) && unlink($cacheExpirationFile)) {
         log::accessLog('fileCache delete() success');
         log::returnLog($str);
         return true;
     } else {
         log::errorLog('fileCache delete() failed');
         return false;
     }
 }
开发者ID:sajawa,项目名称:lib,代码行数:30,代码来源:file.php

示例5: _isset

 /**
  * 检查变量是否存在
  * @access public
  * @static
  * @link _isset
  * @param $key String 变量名
  * @return Boolean
  * @example registry::_isset('foo');
  */
 public static function _isset($key)
 {
     $flag = false;
     if (isset(self::$_var[$key])) {
         $flag = true;
     }
     if (self::$_enableLog) {
         if ($flag) {
             log::accessLog('access object of registry');
             log::returnLog('isset(' . $key . ') return true');
         } else {
             log::returnLog('isset(' . $key . ') return false');
         }
     }
     return $flag;
 }
开发者ID:sajawa,项目名称:lib,代码行数:25,代码来源:registry.php

示例6: parse

 /**
  * 分析一个视图文件并返回结果
  *
  * @param string $filename
  * @param string $view_id
  * @param array $inherited_stack
  *
  * @return string
  */
 public function parse($filename, $view_id = null, array $inherited_stack = null, $default = null, $enableLayout = true)
 {
     if (!$view_id) {
         $view_id = mt_rand();
     }
     $stack = array('id' => $view_id, 'contents' => '', 'extends' => '', 'blocks_stacks' => array(), 'blocks' => array(), 'blocks_config' => array(), 'nested_blocks' => array());
     array_push($this->_stacks, $stack);
     $this->_current = count($this->_stacks) - 1;
     unset($stack);
     ob_start();
     $this->_include($filename);
     $stack = $this->_stacks[$this->_current];
     if ($enableLayout) {
         if (empty($stack['blocks'])) {
             $stack = $default;
             $stack['blocks']['content'] = ob_get_clean();
             $inherited_stack = $stack;
         } else {
             $stack['extends'] = $default['extends'];
             $stack['contents'] = ob_get_clean();
         }
     } else {
         $stack['contents'] = ob_get_clean();
     }
     // 如果有继承视图,则用继承视图中定义的块内容替换当前视图的块内容
     if (is_array($inherited_stack)) {
         foreach ($inherited_stack['blocks'] as $block_name => $contents) {
             if (isset($stack['blocks_config'][$block_name])) {
                 switch (strtolower($stack['blocks_config'][$block_name])) {
                     case 'append':
                         $stack['blocks'][$block_name] .= $contents;
                         break;
                     case 'replace':
                     default:
                         $stack['blocks'][$block_name] .= $contents;
                 }
             } else {
                 $stack['blocks'][$block_name] = $contents;
             }
         }
     }
     // 如果有嵌套 block,则替换内容
     while (list($child, $parent) = array_pop($stack['nested_blocks'])) {
         $stack['blocks'][$parent] = str_replace("%block_contents_placeholder_{$child}_{$view_id}%", $stack['blocks'][$child], $stack['blocks'][$parent]);
         unset($stack['blocks'][$child]);
     }
     // 保存对当前视图堆栈的修改
     $this->_stacks[$this->_current] = $stack;
     if (!$enableLayout) {
         $stack['extends'] = '';
     }
     if ($stack['extends']) {
         // 如果有当前视图是从某个视图继承的,则载入继承视图
         $filename = "{$this->_view_dir}/{$stack['extends']}.{$this->_extname}";
         $data = $this->parse($filename, $view_id, $this->_stacks[$this->_current]);
         log::returnLog($data);
         return $data;
     } else {
         // 最后一个视图一定是没有 extends 的
         $last = array_pop($this->_stacks);
         foreach ($last['blocks'] as $block_name => $contents) {
             $last['contents'] = str_replace("%block_contents_placeholder_{$block_name}_{$last['id']}%", $contents, $last['contents']);
         }
         $this->_stacks = array();
         $data = $last['contents'];
         log::returnLog($data);
         return $data;
     }
 }
开发者ID:sajawa,项目名称:lib,代码行数:78,代码来源:view.php

示例7: delete

 /**
  * 从Cache中删除Key对的应数据
  * @access public
  * @static
  * @param String $key
  * @return boolean
  */
 public static function delete($key)
 {
     if (!self::$_enabled) {
         log::accessLog('Cache disabled');
         log::returnLog(false);
         return false;
     }
     $deleteResult = self::_getInstance()->_connect()->delete($key);
     log::accessLog('Execute delete() success');
     log::returnLog($deleteResult);
     return $deleteResult;
 }
开发者ID:sajawa,项目名称:lib,代码行数:19,代码来源:layer.php

示例8: route

 /**
  * 路由转换处理
  * @access public
  */
 public function route()
 {
     $path = trim(urldecode($this->getPathInfo()), '/');
     $routeMatched = false;
     $routes = $this->_getRoutes();
     if (is_array($routes) && count($routes)) {
         foreach ($routes as $module => $rules) {
             if (is_array($rules) && count($rules)) {
                 foreach ($rules as $rule) {
                     if (isset($rule['rule']) && is_string($rule['rule'])) {
                         $pattern = '#^' . $rule['rule'] . '$#i';
                         $routeMatched = preg_match($pattern, $path, $matches);
                         if ($routeMatched) {
                             array_shift($matches);
                             if (isset($rule['matches']['controller'])) {
                                 $classFile = sprintf('%s/app/%s/%scontroller.php', PROJECT_ROOT, $module, $rule['matches']['controller']);
                                 if (!is_file($classFile)) {
                                     throw new Exception('Error controller file!(' . $rule['matches']['controller'] . ')');
                                     return false;
                                 }
                                 require_once $classFile;
                                 $className = sprintf('%s%sController', strtolower($module), ucfirst($rule['matches']['controller']));
                                 if (!class_exists($className, false)) {
                                     throw new Exception('Error controller name!(' . $className . ')');
                                     return false;
                                 }
                                 $action = 'index';
                                 if (isset($rule['matches']['action'])) {
                                     $action = $rule['matches']['action'];
                                 }
                                 $action = strtolower($action) . 'Action';
                                 $controllerObject = new $className();
                                 if (method_exists($controllerObject, 'init')) {
                                     $controllerObject->init();
                                 }
                                 if (!method_exists($controllerObject, $action)) {
                                     throw new Exception('Error action name(' . $className . '->' . $action . ')');
                                     return false;
                                 }
                                 call_user_func_array(array($controllerObject, $action), $matches);
                                 $routeMatched = true;
                                 break 2;
                             }
                         }
                     }
                 }
             }
         }
     }
     log::accessLog('Execute route() sucessful');
     log::returnLog($routeMatched);
     return $routeMatched;
 }
开发者ID:sajawa,项目名称:lib,代码行数:57,代码来源:router.php

示例9: fieldMapped

 /**
  * convert fields to Mongo parameter array
  * @access 	public
  * @param	array $fields
  * @return 	array result array
  */
 public function fieldMapped($fields)
 {
     if (!$fields) {
         log::errorLog('$fields is empty!');
         return false;
     }
     if (!is_array($fields)) {
         if (trim($fields) == '*') {
             return array();
         }
         //empty array means all
         log::errorLog('$fields format is incorrect');
         return false;
     }
     //make array
     $fieldsArray = array();
     foreach ($fields as $field) {
         if (is_array($field)) {
             $fieldsArray[$field['asname']] = 1;
         } else {
             //empty field skipped
             $field = trim($field);
             if (empty($field)) {
                 continue;
             } else {
                 $fieldsArray[$field] = 1;
             }
         }
     }
     log::accessLog('access fieldMapped() succeess!');
     log::returnLog(var_export($fieldsArray, true));
     return $fieldsArray;
 }
开发者ID:sajawa,项目名称:lib,代码行数:39,代码来源:mongo.php

示例10: sortMapped

 /**
  * sort mapped
  * @access public
  * @link sortMapped
  * @return boolean
  * @example
  * $sorts =
  *  array(
  *  	'application_id' => 'desc' ,  // KEY 為 欄位名稱 , VALUE 為排序方式 , 支援多個 SORT 條件.
  *  	'application_name' => 'asc' ,
  * );
  * accessMysql::sortMapped($sorts);
  */
 public function sortMapped($sorts)
 {
     if (!$sorts) {
         log::errorLog('$sorts is empty!');
         return false;
     }
     if (!is_array($sorts)) {
         log::errorLog('$sorts format is incorrect');
         return false;
     } else {
         $no = 0;
         $sortStr = '';
         if (is_array($sorts)) {
             //print_r($sorts); exit ;
             foreach ($sorts as $sk => $sv) {
                 if ($no == 0) {
                     $sortStr .= " `" . $sk . "` " . $sv . " ";
                 } else {
                     $sortStr .= " , `" . $sk . "` " . $sv . " ";
                 }
                 $no++;
             }
         } else {
             log::errorLog('$sorts format incorrect');
             return false;
         }
     }
     log::accessLog('access sortMapped() success!');
     log::returnLog($sortStr);
     return $sortStr;
 }
开发者ID:sajawa,项目名称:lib,代码行数:44,代码来源:mysql.php

示例11: _getTableNameSpace

 /**
  * 
  * 获取表所在的NameSpace
  * @access public
  * @static
  * @param String $table 表名
  * @return String
  * @example
  * <p>
  * $ns = self::_getTableNameSpace($table);
  * </p>
  */
 private static function _getTableNameSpace($table)
 {
     $table = trim($table);
     $ns = self::MONGO_NS;
     if (in_array($table, self::$_tableMapped[self::MYSQL_NS])) {
         $ns = self::MYSQL_NS;
     }
     log::returnLog($ns);
     return $ns;
 }
开发者ID:sajawa,项目名称:lib,代码行数:22,代码来源:layer.php


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