本文整理汇总了PHP中zotop::error方法的典型用法代码示例。如果您正苦于以下问题:PHP zotop::error方法的具体用法?PHP zotop::error怎么用?PHP zotop::error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zotop
的用法示例。
在下文中一共展示了zotop::error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($config = array())
{
if (!$this->test()) {
zotop::error(zotop::t('The memcache extension is not available'));
}
$host = $config['host'];
$host = empty($host) ? zotop::config('system.cache.memcache.host') : $host;
$host = empty($host) ? '127.0.0.1' : $host;
$post = $config['post'];
$port = empty($port) ? zotop::config('system.cache.memcache.port') : $port;
$port = empty($port) ? '11211' : $port;
$timeout = isset($config['timeout']) ? (bool) $config['timeout'] : false;
$persistent = isset($config['persistent']) ? (bool) $config['persistent'] : false;
unset($config);
//是否持久链接
$connect = $persistent ? 'pconnect' : 'connect';
$this->memcache =& new Memcache();
if ($timeout === false) {
$this->connected = @$this->memcache->{$connect}($host, $port);
} else {
$this->connected = @$this->memcache->{$connect}($host, $port, $timeout);
}
if (!$this->connected) {
zotop::error(zotop::t('无法连接memcache服务器 “{$host}:{$port}”,请检查参数配置是否正确', array('host' => $host, 'port' => $port)));
}
}
示例2: isPostBack
public static function isPostBack()
{
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ((empty($_SERVER['HTTP_REFERER']) || preg_replace("/https?:\\/\\/([^\\:\\/]+).*/i", "\\1", $_SERVER['HTTP_REFERER']) == preg_replace("/([^\\:]+).*/", "\\1", $_SERVER['HTTP_HOST'])) && $_POST['_FORMHASH'] == form::hash()) {
return true;
} else {
zotop::error('invalid submit!');
}
}
return false;
}
示例3: ucfirst
/**
* 生成数据库唯一实例
*
* @param $config
* @return unknown_type
*/
public function &factory($config = '')
{
if (is_string($config)) {
$config = $this->parseDNS($config);
}
if (empty($config['driver'])) {
zotop::error(-1, 'there is some error in database config');
}
$driver = 'Zotop_DataBase_' . ucfirst(strtolower($config['driver']));
if (!zotop::autoload($driver)) {
zotop::error(-1, 'the database driver (' . $driver . ') does not support');
}
$db = new $driver($config);
return $db;
}
示例4: __construct
/**
* 类初始化
*
* @param string|array config 配置
* @return object
*/
public function __construct($config = array())
{
//支持json格式的缓存配置
if (is_string($config)) {
$config = json_decode($config, true);
}
if (is_array($config)) {
$config += array('driver' => zotop::config('system.cache.driver'), 'expire' => (int) zotop::config('system.cache.expire'));
}
if (empty($config['driver'])) {
$config['driver'] = 'file';
}
//缓存驱动程序
$driver = 'cache_' . strtolower($config['driver']);
//加载驱动程序
if (!zotop::autoload($driver)) {
zotop::error(zotop::t('未能找到缓存驱动 "{$driver}"', $config));
}
$this->driver = new $driver($config);
return $this->driver;
}
示例5: query
/**
* 执行一个sql语句 query,相当于包装后的mysql_query
*
* @param $sql
* @param $silent
* @return unknown_type
*/
public function query($sql, $silent = false)
{
if (!is_resource($this->connect)) {
$this->connect();
}
if ($sql = $this->parseSql($sql)) {
//echo $this->sql;
if ($this->query) {
$this->free();
//释放前次的查询结果
}
$this->query = @mysql_query($sql, $this->connect);
//查询数据
if ($this->query === false) {
if ($silent) {
return false;
}
zotop::error(-3, '查询语句错误', zotop::t('<h2>SQL: {$sql}</h2>{$error}', array('sql' => $sql, 'error' => @mysql_error())));
}
$this->numRows = mysql_num_rows($this->query);
return $this->query;
}
return false;
}
示例6: array
/**
* 生成数据库唯一实例
*
* @param $config
* @return object
*/
public function &instance($config = array())
{
static $instances = array();
//实例唯一的编号
$id = serialize($config);
if (!isset($instances[$id])) {
if (is_string($config)) {
$config = $this->parseDNS($config);
}
if (empty($config['driver'])) {
zotop::error(zotop::t('错误的数据库配置文件', $config));
}
//数据库驱动程序
$driver = 'database_' . strtolower($config['driver']);
//加载驱动程序
if (!zotop::autoload($driver)) {
zotop::error(zotop::t('未能找到数据库驱动 "{$driver}"', $config));
}
//取得驱动实例
$instance = new $driver($config);
$instances[$id] =& $instance;
}
return $instances[$id];
}
示例7: read
/**
* 读取具体的某条数据
*
* 空条件:$model->read();前面必须定义过主键值: $model->id = 1;
* 默认条件:$model->read(1) 相当于 $model->read(array('id','=',1))
* 自定义条件:$model->read(array('id','=',1))
*
* @param mix $value 键值
*
* @return array
*/
public function read($value = '')
{
if (is_array($value)) {
$this->db()->where($value);
} else {
$key = $this->getPrimaryKey();
if (empty($value)) {
$value = $this->{$key};
}
$this->db()->where($key, '=', $value);
}
$this->data = $this->db()->select('*')->from($this->getTableName())->getRow();
if ($this->data === null) {
zotop::error(zotop::t('未能找到 <b>{$key}</b> 等于 <b>{$value}</b> 的数据<br>' . reset($this->db->sql()), array('key' => $key, 'value' => $value)));
}
return $this->data;
}
示例8: execute
/**
* 数据查询,该方法必须被重载,实现数据库的查询,无返回
*
* @return null
*/
public function execute()
{
zotop::error(zotop::t('函数必须被重载'));
}
示例9: model
/**
* 用于实例化一个模型{module}.{model},如 zotop.user,实例化系统模块的user模型
*
*
* @param $name 模型名称空间
* @return object(model)
*/
public static function model($name = '')
{
static $models = array();
if (empty($name)) {
return new model();
}
if (isset($models[$name])) {
return $models[$name];
}
list($module, $model) = explode('.', $name);
$modelName = $model . '_model';
if (!class_exists($modelName)) {
$modelPath = zotop::module($module, 'path') . DS . 'models' . DS . $model . '.php';
if (zotop::load($modelPath) == false) {
zotop::error(zotop::t('<h2>请检查相应的模型文件是否存在</h2>文件地址:{$modelPath}', array('modelPath' => $modelPath)));
}
}
if (class_exists($modelName)) {
$m = new $modelName();
$m->moduleName = $module;
$models[$name] = $m;
return $m;
}
zotop::error(zotop::t('<h2>请检查相应的模型文件中是否存在模型类 {$modelName}</h2>文件地址:{$modelPath}', array('modelPath' => $modelPath, 'modelName' => $modelName)));
}
示例10: rename
/**
* 文件重命名
*
* @param string $file 文件路径
* @param string $newname 新文件名称,含文件扩展名
*
* @return bool
* @since 0.1
*/
public static function rename($file, $newname)
{
$file = path::decode($file);
$path = dirname($file);
$newfile = $path . DS . file::safename($newname);
if ($file == $newfile) {
zotop::error(zotop::t('目标文件名称和原文件名称相同'));
return false;
} elseif (file::exists($newfile)) {
zotop::error(zotop::t('目标文件已经存在'));
return false;
} elseif (rename($file, $newfile)) {
return true;
}
return false;
}
示例11: execute
/**
* 应用程序执行
*
*
* @return null
*/
public static function execute()
{
if (zotop::module(application::module()) === null || (int) zotop::module(application::module(), 'status') < 0) {
msg::error(array('title' => '404 error', 'content' => zotop::t('<h2>未能找到模块,模块可能尚未安装或者已经被禁用?</h2>'), 'detail' => zotop::t('模块名称:{$module}', array('module' => application::$module))));
}
define('ZOTOP_MODULE', application::module());
define('ZOTOP_MODULE_PATH', zotop::module(application::module(), 'path'));
define('ZOTOP_MODULE_URL', zotop::module(application::module(), 'url'));
$controllerPath = ZOTOP_MODULE_PATH . DS . ZOTOP_APPLICATION . DS . application::controller() . '.php';
if (zotop::load($controllerPath)) {
} elseif (zotop::load(ZOTOP_MODULE_PATH . DS . ZOTOP_GROUP . DS . 'default.php')) {
$controllerPath = ZOTOP_MODULE_PATH . DS . ZOTOP_GROUP . DS . 'default.php';
application::$arguments = array_merge(array(application::$controller), array(application::$action), application::$arguments);
application::$controller = 'default';
application::$action = '';
} else {
zotop::error(array('title' => '404 error', 'content' => zotop::t('<h2>未能找到控制器,请检查控制器文件是否存在?</h2>'), 'detail' => zotop::t('文件名称:{$file}', array('file' => $controllerPath))));
}
define('ZOTOP_CONTROLLER', application::controller());
$class = application::module() . '_controller_' . application::controller();
if (class_exists($class, false)) {
//实例化控制器
$controller = new $class();
if (!method_exists($controller, 'action' . ucfirst(application::action()))) {
if (strlen(application::action()) > 0) {
application::$arguments = array_merge(array(application::$action), application::$arguments);
}
application::$action = $controller->action;
}
define('ZOTOP_ACTION', application::action());
if (method_exists($controller, 'action' . ucfirst(application::action()))) {
zotop::run("system.execute.before");
call_user_func_array(array($controller, 'action' . ucfirst(application::action())), application::arguments());
zotop::run("system.execute.after");
} else {
call_user_func_array(array($controller, '__empty'), array(application::action(), application::arguments()));
}
} else {
zotop::error(array('title' => '404 error', 'content' => zotop::t('<h2>未能找到控制器类,请检查控制器文件中是否存在控制器类?</h2>'), 'detail' => zotop::t('类名称:{$className}', array('className' => $class))));
}
}
示例12: __empty
public function __empty($action = '', $arguments = '')
{
zotop::error(array('title' => '404 error', 'content' => zotop::t('<h2>未能找到相应的动作,请检查控制器中动作是否存在?</h2>'), 'detail' => zotop::t('动作名称:{$action}', array('action' => $action))));
}
示例13: model
/**
* 用于实例化一个模型{module}.{model},如 zotop.user,实例化系统模块的user模型
*
*
* @param $name 模型名称空间
* @return object(model)
*/
public static function model($name = '')
{
static $models = array();
if (empty($name)) {
return new model();
}
if (isset($models[$name])) {
return $models[$name];
}
list($module, $model) = explode('.', $name);
$modelName = $module . '_model_' . $model;
if (!class_exists($modelName)) {
$modelPath = zotop::modules($module, 'path') . DS . 'models' . DS . $model . '.php';
if (zotop::load($modelPath) == false) {
zotop::error(array('content' => zotop::t('请检查相应的模型文件是否存在'), 'detail' => zotop::t('文件地址:{$modelPath}', array('modelPath' => $modelPath))));
}
}
if (class_exists($modelName)) {
$m = new $modelName();
$models[$name] = $m;
return $m;
}
zotop::error(array('content' => zotop::t('请检查相应的模型文件中是否存在模型类 :{$modelName}', array('modelPath' => $modelPath, 'modelName' => $modelName)), 'detail' => zotop::t('文件地址:{$modelPath}', array('modelPath' => $modelPath, 'modelName' => $modelName))));
}
示例14: instance
public static function instance($classname, $method = '', $args = array())
{
static $instances = array();
$id = empty($args) ? strtolower($classname . $method) : strtolower($classname . $method . rand::guid($args));
if (!isset($instances[$id])) {
if (class_exists($classname)) {
$instance = new $classname();
if (method_exists($instance, $method)) {
$instances[$id] = call_user_func_array(array(&$instance, $method), $args);
} else {
$instances[$id] = $instance;
}
} else {
zotop::error($classname . ' not found!');
}
}
return $instances[$id];
}
示例15: getControllerPath
/**
* 返回当前的控制器的真实路径
*
* @return string
*/
public static function getControllerPath()
{
$controller = application::getController();
$module = application::getModule();
$path = zotop::module($module, 'path');
if (empty($path)) {
zotop::error(array('title' => '系统错误', 'content' => zotop::t('<h2>未能找到相应模块,请检查模块是否未安装或者已被禁用?</h2>模块名称:{$module}', array('module' => $module))));
}
$path = $path . DS . router::application() . DS . $controller . '.php';
return $path;
}