本文整理汇总了PHP中Error::info方法的典型用法代码示例。如果您正苦于以下问题:PHP Error::info方法的具体用法?PHP Error::info怎么用?PHP Error::info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Error
的用法示例。
在下文中一共展示了Error::info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_block_app
function smarty_block_app($params, $body, &$smarty)
{
if (empty($body)) {
return;
}
if (!array_key_exists('name', $params)) {
Error::info('Tag param error:', 'app标签必须有参数name!');
return;
}
if (array_key_exists('func', $params)) {
$func = $params['func'];
unset($params['func']);
} else {
$func = 'getList';
}
$fields = implode(',', SwooleTemplate::get_fields($body));
global $php;
$php->createModel($model);
if (array_key_exists('titlelen', $params)) {
$titlelen = $params['titlelen'];
unset($params['titlelen']);
$php->model->{$model}->select = str_replace('title', "substring( title, 1, {$titlelen} ) AS title", $fields);
} else {
$php->model->{$model}->select = $fields;
}
$data = call_user_func(array($php->model->{$model}, $func), $params);
return SwooleTemplate::parse_loop($data, $body, $fields);
}
示例2: __construct
/**
* 错误对象
* @param $error 如果为INT,则读取错误信息字典,否则设置错误字符串
* @param $stop 是否终止程序运行(exit)
* @return unknown_type
*/
function __construct($error)
{
if (is_numeric($error)) {
if (empty($this->error_id)) {
include LIBPATH . '/data/text/error_code.php';
//错误ID
$this->error_id = (int) $error;
//错误信息
if (!isset(self::$error_code[$this->error_id])) {
$this->error_msg = self::$error_code[$this->error_id];
parent::__construct($this->error_msg, $error);
}
}
} else {
$this->error_id = 0;
$this->error_msg = $error;
parent::__construct($error);
}
global $php;
//如果定义了错误监听程序
if (isset($php->error_call[$this->error_id])) {
call_user_func($php->error_call[$this->error_id], $error);
}
if (self::$stop) {
exit(Error::info('Swoole Error', $this->error_msg));
}
}
示例3: create
/**
* 获取缓存对象
* @param $scheme
* @return cache object
*/
static function create($config)
{
if (empty(self::$backends[$config['type']])) {
return Error::info('Cache Error', "cache backend: {$config['type']} no support");
}
$backend = "\\Swoole\\Cache\\" . self::$backends[$config['type']];
return new $backend($config);
}
示例4: __construct
function __construct($params, $backend = 'FileLog')
{
if (!in_array($backend, $this->backends)) {
Error::info('Log backend Error', "Log backend <b>{$backend}</b> not no support!");
}
import('#log.' . $backend);
$this->backend = new $backend($params);
}
示例5: query
/**
* 执行一个SQL语句
* @param $sql 执行的SQL语句
*/
function query($sql)
{
parent::real_escape_string($sql);
$res = parent::query($sql);
if (!$res) {
echo Error::info("SQL Error", $this->error . "<hr />{$sql}");
}
return new MySQLiRecord($res);
}
示例6: get_cache
/**
* 获取缓存对象
* @param $scheme
* @return cache object
*/
static function get_cache($config)
{
if (empty(self::$backends[$config['protocol']])) {
return Error::info('Cache Error', "cache backend:{$config['protocol']} no support");
}
$backend = self::$backends[$config['protocol']];
import('#cache.' . $backend);
return new $backend($config);
}
示例7: query
/**
* 执行一个SQL语句
* @param $sql 执行的SQL语句
*/
function query($sql)
{
mysql_real_escape_string($sql, $this->conn);
$res = mysql_query($sql, $this->conn);
if (!$res) {
echo Error::info("SQL Error", mysql_error($this->conn) . "<hr />{$sql}");
}
return new MySQLRecord($res);
}
示例8: query
/**
* 执行一个SQL语句
* @param $sql 执行的SQL语句
*/
public final function query($sql)
{
if ($this->debug) {
echo "{$sql}<br />\n<hr />";
}
parent::quote($sql);
$res = parent::query($sql) or Error::info("SQL Error", implode(", ", $this->errorInfo()) . "<hr />{$sql}");
return $res;
}
示例9: set
/**
* 写入字典内容
* @param $dictname
*/
static function set($dictname, $dict)
{
if (!self::$swoole->cache) {
Error::info('SiteDict Cache Error', 'Please load Cache!');
}
$filename = self::$data_dir . '/' . $dictname . '.php';
self::write($dictname, $dict, $filename);
self::delete($dictname);
}
示例10: load
/**
* 导入插件
* @param $plugin_name
* @return unknown_type
*/
function load($plugin_name, $plugin_param = null)
{
$path = WEBPATH . '/swoole_plugin/' . $plugin_name . '/Swoole.plugin.php';
if (file_exists($path)) {
require_once $path;
$this->plugins[$plugin_name] = $swoole_plugin;
} else {
Error::info('Plugin not Found!', "Plugin file <b>{$path}</b> not exists!");
}
}
示例11: display
/**
* render template file, then display it.
* @param string $tpl_file
*/
function display($tpl_file = '')
{
if (empty($tpl_file)) {
$tpl_file = $this->swoole->env['mvc']['controller'] . '/' . $this->swoole->env['mvc']['view'] . '.php';
}
if (!is_file($this->template_dir . $tpl_file)) {
Error::info('template error', "template file[" . $this->template_dir . $tpl_file . "] not found");
}
extract($this->tpl_var);
include $this->template_dir . $tpl_file;
}
示例12: getContent
function getContent(&$attrs)
{
$select = new SelectDB($this->db);
$select->call_by = 'smarty';
if (isset($attrs['typeid'])) {
$attrs['catid'] = $attrs['typeid'];
unset($attrs['typeid']);
if (is_numeric($attrs['typeid'])) {
$cate = $this->swoole->createModel('Category');
$category = $cate->get($attrs['fid']);
$select->from(TABLE_PREFIX . '_' . $category['modelname']);
} elseif (isset($attrs['app'])) {
$app = $this->swoole->createModel('App');
$app_config = $app->getConfig($attrs['app']);
$select->from($app_config['tablename']);
unset($attrs['app']);
} else {
Error::info('Tpl Error', 'Nested structure must have `app` param!');
}
} elseif (isset($attrs['app'])) {
$app = $this->swoole->createModel('App');
$app_config = $app->getConfig($attrs['app']);
$select->from($app_config['tablename']);
unset($attrs['app']);
} else {
Error::info('Param Error', 'Get content must have param `typeid` or `app` !');
}
if (array_key_exists('select', $attrs)) {
$select->select = $attrs['select'];
}
if (array_key_exists('titlelen', $attrs)) {
$titlelen = $attrs['titlelen'];
unset($attrs['titlelen']);
$select->select = str_replace('title', "substring( title, 1, {$titlelen} ) AS title,title as title_full", $attrs['select']);
}
$select->limit(isset($attrs['row']) ? $attrs['row'] : 10);
unset($attrs['row']);
$select->order(isset($attrs['order']) ? $attrs['order'] : 'id desc');
unset($attrs['order']);
unset($attrs['get'], $attrs['name'], $attrs['key'], $attrs['func']);
$select->put($attrs);
if (array_key_exists('page', $attrs)) {
$select->paging();
$php->env['start'] = 10 * intval($attrs['page'] / 10);
if ($select->pages > 10 and $attrs['page'] < $start) {
$php->env['more'] = 1;
}
$php->env['end'] = $select->pages - $php->env['start'];
$php->env['end'] = $select->pages;
$php->env['end'] = $select->page_size;
$php->env['end'] = $select->num;
}
return $select->getsql();
}
示例13: run
function run()
{
if (!empty($_GET['action'])) {
$this->action = $_GET['action'];
}
$this->action = Validate::word($this->action);
$method = self::$method_prefix . '_' . $this->action;
if (method_exists($this, $method)) {
call_user_func(array($this, $method));
} else {
Error::info('GeneralView Error!', "View <b>{$this->app_name}->{$method}</b> Not Found!");
}
}
示例14: connect
public static function connect()
{
// One connection for the app
if (self::$cont === null) {
try {
self::$cont = new PDO("mysql:host=" . HOST . ";" . "dbname=" . DATABASE, USER, PASSWORD);
} catch (PDOException $e) {
echo "Error with PDO " . Error::info();
echo $e->message();
die;
}
}
return self::$cont;
}
示例15: loadModel
/**
* 加载一个模型对象
* @param $model_name 模型名称
* @return $model_object 模型对象
*/
static function loadModel($model_name)
{
if (isset(self::$_objects['model'][$model_name])) {
return self::$_objects['model'][$model_name];
} else {
$model_file = APPSPATH . '/models/' . $model_name . '.model.php';
if (!file_exists($model_file)) {
Error::info('MVC错误', "不存在的模型, <b>{$model_name}</b>");
}
require $model_file;
self::$_objects['model'][$model_name] = new $model_name(self::$swoole);
return self::$_objects['model'][$model_name];
}
}