本文整理汇总了PHP中log::errorLog方法的典型用法代码示例。如果您正苦于以下问题:PHP log::errorLog方法的具体用法?PHP log::errorLog怎么用?PHP log::errorLog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类log
的用法示例。
在下文中一共展示了log::errorLog方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: autoload
private function autoload($class)
{
$eject_array = array('gadgetIndexAbstract', 'gadgetIndexController', 'gadgetApplicationController', 'gadgetApplicationAbstract');
if (!is_array(self::$_maps)) {
self::$_maps = (include ROOT_DIR . DS . 'conf' . DS . 'maps.php');
}
$pattern = '/[A-Z][a-z0-9]+/';
preg_match_all($pattern, $class, $matches);
$prefix = null;
$path = null;
if (isset($matches[0]) && !empty($matches[0])) {
$prefix = substr($class, 0, stripos($class, $matches[0][0]));
if ($prefix == 'read' || $prefix == 'write') {
return;
}
$path = '';
foreach ($matches[0] as $m) {
$path .= strtolower($m) . DS;
}
$path = rtrim($path, DS) . '.php';
} else {
$path = strtolower($class) . '.php';
}
if (in_array($class, $eject_array)) {
$path = str_replace('/', '', $path);
}
if ($prefix && isset(self::$_maps[$prefix])) {
$classPath = self::$_maps[$prefix];
} else {
$classPath = ROOT_DIR . DS . 'common' . DS;
}
if (is_array($classPath)) {
$required = false;
foreach ($classPath as $cp) {
if (file_exists($cp . $path)) {
require $cp . $path;
$required = true;
break;
}
}
if (!$required) {
log::errorLog($class . ': FileNotFound');
return false;
}
} else {
if (file_exists($classPath . $path)) {
require $classPath . $path;
} else {
log::errorLog($class . ': FileNotFound');
return false;
}
}
}
示例2: get
/**
* 获取全局变量
* @access public
* @static
* @link get
* @param $key String 变量名
* @return mixed 变量值
* @example registry::get('foo');
*/
public static function get($key)
{
if (!isset(self::$_var[$key])) {
if (self::$_enableLog) {
log::errorLog('there has no this(' . $key . ') global variable');
}
return false;
} else {
if (self::$_enableLog) {
log::accessLog('access object of registry');
log::returnLog('return variable(' . $key . ')');
}
return self::$_var[$key];
}
}
示例3: get
/**
* get config
* @access public
* @static
* @param string $name
* @return mixed
* @example
* <p>
* $name = 'database.params';
* $params = config::get($name);
* </p>
*/
public static function get($name = null)
{
if (empty($name)) {
return self::$_config;
}
$segments = explode('.', $name);
if (1 < count($segments)) {
$config = self::$_config;
foreach ($segments as $segment) {
if (isset($config[$segment])) {
$config = $config[$segment];
} else {
log::errorLog('config item(' . $name . ') not found');
return false;
}
}
return $config;
} else {
if (isset(self::$_config[$name])) {
return self::$_config[$name];
} else {
log::errorLog('config item(' . $name . ') not found');
return false;
}
}
}
示例4: 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;
}
示例5: 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;
}
}
示例6: 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;
}
示例7: fetch
/**
* 渲染视图并返回渲染结果
*
* @param string $viewname
* @param array $vars
* @param array $config
*
* @return string
*/
public function fetch($viewname = null, array $vars = null, array $config = null)
{
if (!$this->_enableView) {
die;
}
if (empty($viewname)) {
$viewname = $this->_viewname;
}
$this->_before_render();
$view_dir = isset($config['view_dir']) ? $config['view_dir'] : $this->view_dir;
$view_dir = !empty(self::$_viewDir) ? self::$_viewDir : $view_dir;
$extname = isset($config['file_extname']) ? $config['file_extname'] : $this->file_extname;
$filename = "{$view_dir}/{$viewname}.{$extname}";
if (file_exists($filename)) {
if (!is_array($vars)) {
$vars = $this->_vars;
}
if (is_null($this->_parser)) {
$parser_name = $this->_parser_name;
$this->_parser = new $parser_name($view_dir);
}
if ($this->_enableLayout) {
$output = $this->_parser->assign($vars)->parse($filename, null, null, array('id' => mt_rand(), 'contents' => '', 'extends' => '_layout/default_layout', 'blocks_stacks' => array('content'), 'blocks' => array('content'), 'blocks_config' => array('content' => null), 'nested_blocks' => array()));
} else {
$output = $this->_parser->assign($vars)->parse($filename, null, null, array('id' => mt_rand(), 'contents' => '', 'extends' => '_layout/default_layout', 'blocks_stacks' => array('content'), 'blocks' => array('content'), 'blocks_config' => array('content' => null), 'nested_blocks' => array()), false);
}
} else {
log::errorLog('Error view file:' . $filename);
return false;
}
$this->_after_render($output);
$this->_viewData = $output;
log::accessLog('fetch view success');
log::returnLog($output);
return $output;
}
示例8: _connect
/**
* 获取Cache访问对象并连接Cache
*
* @access public
* @return Object cacheObject extended cacheAbstract
* @example
* <p>
* $cacheObject = cacheLayer::_getInstance()->connect();
* </p>
*/
private function _connect()
{
if (!$this->_cacheObject instanceof cacheAbstract) {
if (empty(self::$_config['cacheType'])) {
log::errorLog('Cache type is empty!');
return false;
}
$className = 'cache' . ucfirst(strtolower(self::$_config['cacheType']));
$cacheObject = new $className(self::$_config['params']);
if (!$cacheObject instanceof cacheAbstract) {
log::errorLog($className . ' is not cacheAbstract instance');
return false;
}
$cacheObject->connect();
$this->_cacheObject =& $cacheObject;
log::accessLog('Create ' . $className . ' object success');
}
log::returnLog($this->_cacheObject);
return $this->_cacheObject;
}
示例9: setBaseUrl
/**
* 设置base Url
* @access public
* @param string $baseUrl
* @return void
*/
public function setBaseUrl($baseUrl = null)
{
if (null !== $baseUrl && !is_string($baseUrl)) {
log::errorLog('Error baseUrl value!');
return false;
}
if ($baseUrl === null) {
$filename = isset($_SERVER['SCRIPT_FILENAME']) ? basename($_SERVER['SCRIPT_FILENAME']) : '';
if (isset($_SERVER['SCRIPT_NAME']) && basename($_SERVER['SCRIPT_NAME']) === $filename) {
$baseUrl = $_SERVER['SCRIPT_NAME'];
} elseif (isset($_SERVER['PHP_SELF']) && basename($_SERVER['PHP_SELF']) === $filename) {
$baseUrl = $_SERVER['PHP_SELF'];
} elseif (isset($_SERVER['ORIG_SCRIPT_NAME']) && basename($_SERVER['ORIG_SCRIPT_NAME']) === $filename) {
$baseUrl = $_SERVER['ORIG_SCRIPT_NAME'];
// 1and1 shared hosting compatibility
} else {
// Backtrack up the script_filename to find the portion matching
// php_self
$path = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : '';
$file = isset($_SERVER['SCRIPT_FILENAME']) ? $_SERVER['SCRIPT_FILENAME'] : '';
$segs = explode('/', trim($file, '/'));
$segs = array_reverse($segs);
$index = 0;
$last = count($segs);
$baseUrl = '';
do {
$seg = $segs[$index];
$baseUrl = '/' . $seg . $baseUrl;
++$index;
} while ($last > $index && false !== ($pos = strpos($path, $baseUrl)) && 0 != $pos);
}
// Does the baseUrl have anything in common with the request_uri?
$requestUri = $this->getRequestUri();
if (0 === strpos($requestUri, $baseUrl)) {
// full $baseUrl matches
$this->_baseUrl = $baseUrl;
} else {
if (0 === strpos($requestUri, dirname($baseUrl))) {
// directory portion of $baseUrl matches
$this->_baseUrl = rtrim(dirname($baseUrl), '/');
} else {
$truncatedRequestUri = $requestUri;
if (($pos = strpos($requestUri, '?')) !== false) {
$truncatedRequestUri = substr($requestUri, 0, $pos);
}
$basename = basename($baseUrl);
if (empty($basename) || !strpos($truncatedRequestUri, $basename)) {
// no match whatsoever; set it blank
$this->_baseUrl = '';
} else {
if (strlen($requestUri) >= strlen($baseUrl) && (false !== ($pos = strpos($requestUri, $baseUrl)) && $pos !== 0)) {
// If using mod_rewrite or ISAPI_Rewrite strip the script filename
// out of baseUrl. $pos !== 0 makes sure it is not matching a value
// from PATH_INFO or QUERY_STRING
$baseUrl = substr($requestUri, 0, $pos + strlen($baseUrl));
}
}
}
}
}
$this->_baseUrl = rtrim($baseUrl, '/');
log::accessLog('Execute setBaseUrl successful!');
}
示例10: 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;
}
示例11: __destruct
public function __destruct()
{
if (!$this->close()) {
log::errorLog('__destruct fail');
}
log::accessLog('access close() success!');
//log::returnLog(true);
//return true ;
}