當前位置: 首頁>>代碼示例>>PHP>>正文


PHP View::error方法代碼示例

本文整理匯總了PHP中View::error方法的典型用法代碼示例。如果您正苦於以下問題:PHP View::error方法的具體用法?PHP View::error怎麽用?PHP View::error使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在View的用法示例。


在下文中一共展示了View::error方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: backupInit

 public function backupInit($config)
 {
     F('_backup_', '[del]');
     //創建目錄
     if (!is_dir($config['dir']) && !mkdir($config['dir'], 0755, true)) {
         View::error('目錄創建失敗', $config['url']);
     }
     $table = Db::getAllTableInfo();
     $table = $table['table'];
     foreach ($table as $d) {
         //limit起始數
         $table[$d['tablename']]['first'] = 0;
         //文件編號
         $table[$d['tablename']]['fileId'] = 1;
     }
     $cache['table'] = $table;
     $cache['config'] = $config;
     //備份表結構
     $tables = Db::getAllTableInfo();
     $sql = "<?php if(!defined('HDPHP_PATH'))EXIT;\n";
     foreach ($tables['table'] as $table => $data) {
         $createSql = Db::select("SHOW CREATE TABLE {$table}");
         $sql .= "Db::execute(\"DROP TABLE IF EXISTS {$table}\");\n";
         $sql .= "Db::execute(\"{$createSql[0]['Create Table']}\");\n";
     }
     if (file_put_contents($config['dir'] . '/structure.php', $sql)) {
         file_put_contents($config['dir'] . '/config.php', "<?php return " . var_export($config, true) . ";");
         F('_backup_', $cache);
         return true;
     } else {
         F('_backup_' . '[del]');
         $this->error = '表結構備份失敗';
         return false;
     }
 }
開發者ID:arnold1119,項目名稱:cms,代碼行數:35,代碼來源:Backup.php

示例2: forgotpwd

 /**
  * Forgot password
  */
 private function forgotpwd()
 {
     if (isset($_POST['forgotpwd'])) {
         $email = $_POST['email'];
         if (!Validate::len($email)) {
             $error = 'Email character count must be between 4 and 64';
         } elseif (!Validate::email($email)) {
             $error = 'Please enter a valid email';
         }
         if (!$error) {
             $user = User::where('email', $email)->select('id')->findOne();
             if (!$user) {
                 $error = 'Email address not found';
             }
         }
         if ($error) {
             View::error('user/forgotpwd', $error);
         }
         // Makes an internal session
         $pwd = Session::set('pwd', $user->id, 0);
         View::set('session_pwd', $pwd);
         Base::sendMail($email, 'forgotpwd');
         Base::redirect('', 'Go to your email and follow the instructions');
     } elseif (isset($_GET['pwd'])) {
     }
 }
開發者ID:nytr0gen,項目名稱:plur-music-explorer,代碼行數:29,代碼來源:user.php

示例3: login

 /**
  * [login 登錄]
  * @return [type] [description]
  */
 public function login()
 {
     if (IS_POST) {
         if (strtoupper(I('post.code')) != strtoupper(myRedis::get('code'))) {
             View::error('驗證碼錯誤!', 'http://' . __HOST__ . '/admin/login/');
             die;
         }
         $userName = I('post.username');
         $password = I('post.password');
         $pwd = md5('ISirweb' . $password);
         $userData = Admin::where(['who' => $userName, 'mypwd' => $pwd])->get()->toArray();
         if (empty($userData)) {
             View::error('用戶名或密碼錯誤!', 'http://' . __HOST__ . '/admin/login/');
             die;
         }
         //如果未修改php.ini下麵兩行注釋去掉
         // ini_set('session.save_handler', 'redis');
         // ini_set('session.save_path', 'tcp://127.0.0.1:6379');
         session_start();
         $_SESSION['uid'] = $userData[0]['id'];
         $_SESSION['name'] = $userData[0]['who'];
         $_SESSION['email'] = $userData[0]['email'];
         View::success('登錄成功', 'http://' . __HOST__ . '/admin/');
         die;
     }
     $this->smarty->assign('title', '登錄_ISisWeb中文網_ISirPHPFramework');
     $this->smarty->display('Admin/Login/login.html');
     die;
 }
開發者ID:joymi,項目名稱:ISirPHPFramework,代碼行數:33,代碼來源:LoginContoller.php

示例4: edit

 public function edit()
 {
     if (IS_POST) {
         if ($this->db->edit()) {
             View::success('操作成功', 'index');
         } else {
             View::error($this->db->getError());
         }
     } else {
         //商品分類
         $cate = new \Admin\Model\ShopCate();
         $cateData = $cate->getAll();
         View::with('cateData', $cateData);
         //商品品牌
         $brand = new \Admin\Model\ShopBrand();
         $brandData = $brand->getAll();
         View::with('brandData', $brandData);
         //獲取圖集信息
         $pics = new \Admin\Model\Pics();
         $picsData = $pics->getAll();
         View::with('picsData', $picsData);
         //商品類型列表
         $type = new \Admin\Model\ShopType();
         $typeData = $type->getAll();
         View::with('typeData', $typeData);
         //商品屬性列表
         $attr = new \Admin\Model\GoodsAttr();
         $attrData = $attr->getAll(Q('goods_id'));
         View::with('attrData', $attrData);
         //讀取商品信息
         $field = $this->db->getOne();
         View::with('field', $field)->make();
     }
 }
開發者ID:ChenHuaPHP,項目名稱:ZOLshop,代碼行數:34,代碼來源:GoodsController.php

示例5: init

 /**
  * Starting point for every page request. Loads required core modules, gets data from url and calls
  * necessary modules to make things happen.
  */
 public static function init()
 {
     if (!self::$_inited) {
         self::$_inited = true;
         foreach (self::$_requiredCore as $module) {
             require_once ROOT . 'core/' . $module . '/' . $module . EXT;
         }
         // Set the Load::auto method to handle all class loading from now on
         spl_autoload_register('Load::auto');
         Load::loadSetupFiles();
         // If CLI mode, everything thats needed has been loaded
         if (IS_CLI) {
             return;
         }
         date_default_timezone_set(Config::get('system.timezone'));
         Event::trigger('caffeine.started');
         // If maintenance mode has been set in the config, stop everything and load mainteance view
         if (Config::get('system.maintenance_mode')) {
             View::error(ERROR_MAINTENANCE);
         } else {
             list($route, $data) = Router::getRouteData();
             if ($data) {
                 if (self::_hasPermission($route, $data)) {
                     list($module, $controller, $method) = $data['callback'];
                     $params = Router::getParams();
                     // Make sure controller words are upper-case
                     $conBits = explode('_', $controller);
                     foreach ($conBits as &$bit) {
                         $bit = ucfirst($bit);
                     }
                     $controller = implode('_', $conBits);
                     $controller = sprintf('%s_%sController', ucfirst($module), ucwords($controller));
                     // Call the routes controller and method
                     if (method_exists($controller, $method)) {
                         $response = call_user_func_array(array($controller, $method), $params);
                         if (!self::_isErrorResponse($response)) {
                             Event::trigger('module.response', array($response));
                             View::load($module, $controller, $method);
                         } else {
                             View::error($response);
                         }
                     } else {
                         Log::error($module, sprintf('The method %s::%s() called by route %s doesn\'t exist.', $controller, $method, $route));
                         View::error(ERROR_500);
                     }
                 } else {
                     View::error(ERROR_ACCESSDENIED);
                 }
             } else {
                 if ($route !== '[index]' || !View::directLoad('index')) {
                     View::error(ERROR_404);
                 }
             }
         }
         View::output();
         Event::trigger('caffeine.finished');
     } else {
         die('Why are you trying to re-initialize Caffeine?');
     }
 }
開發者ID:simudream,項目名稱:caffeine,代碼行數:64,代碼來源:index.php

示例6: __construct

 public function __construct()
 {
     parent::__construct();
     session_start();
     if (!isset($_SESSION['uid'])) {
         View::error('請登錄。。。', 'http://' . __HOST__ . '/admin/login/');
         die;
     }
 }
開發者ID:joymi,項目名稱:ISirPHPFramework,代碼行數:9,代碼來源:CommonController.php

示例7: initialize

 /**
  * Callback que se ejecuta antes de los métodos de todos los controladores
  */
 protected final function initialize()
 {
     /**
      * Si el método de entrada es ajax, el tipo de respuesta es sólo la vista
      */
     if (Input::isAjax()) {
         View::template(null);
     }
     /**
      * Verifico que haya iniciado sesión
      */
     if (!MkcAuth::isLogged()) {
         //Verifico que no genere una redirección infinita
         if ($this->controller_name != 'login' && ($this->action_name != 'entrar' && $this->action_name != 'salir')) {
             MkcMessage::warning('No has iniciado sesión o ha caducado.');
             //Verifico que no sea una ventana emergente
             if ($this->module_name == 'reporte') {
                 View::error();
                 //TODO: crear el método error()
             } else {
                 MkcRedirect::toLogin('sistema/login/entrar/');
             }
             return false;
         }
     } else {
         if (MkcAuth::isLogged() && $this->controller_name != 'login') {
             $acl = new MkcAcl();
             //Cargo los permisos y templates
             if (APP_UPDATE && Session::get('perfil_id') != Perfil::SUPER_USUARIO) {
                 //Solo el super usuario puede hacer todo
                 if ($this->module_name != 'dashboard' && $this->controller_name != 'index') {
                     $msj = 'Estamos en labores de actualización y mantenimiento.';
                     $msj .= '<br />';
                     $msj .= 'El servicio se reanudará dentro de ' . APP_UPDATE_TIME;
                     if (Input::isAjax()) {
                         View::update();
                     } else {
                         MkcMessage::info($msj);
                         MkcRedirect::to("dashboard");
                     }
                     return FALSE;
                 }
             }
             if (!$acl->check(Session::get('perfil_id'))) {
                 MkcMessage::error('Tu no posees privilegios para acceder a <b>' . Router::get('route') . '</b>');
                 Input::isAjax() ? View::ajax() : View::select(NULL);
                 return false;
             }
             if (!defined('SKIN')) {
                 define('SKIN', Session::get('tema'));
             }
         }
     }
 }
開發者ID:slrondon,項目名稱:WispCenter,代碼行數:57,代碼來源:backend_controller.php

示例8: edit

 public function edit()
 {
     if (IS_POST) {
         if ($this->db->edit()) {
             View::success('操作成功', 'index');
         } else {
             View::error($this->db->getError());
         }
     } else {
         $field = $this->db->getOne();
         View::with('field', $field)->make();
     }
 }
開發者ID:ChenHuaPHP,項目名稱:ZOLshop,代碼行數:13,代碼來源:ShopAttrController.php

示例9: listar

 /**
  * Método para listar las autitorías del sistema
  * @param type $fecha
  * @return type
  */
 public function listar($fecha = '', $formato = 'html')
 {
     $fecha = empty($fecha) ? date("Y-m-d") : Filter::get($fecha, 'date');
     if (empty($fecha)) {
         DwMessage::info('Selecciona la fecha del archivo');
         return View::error();
     }
     $audits = Sistema::getAudit($fecha);
     $this->audits = $audits;
     $this->fecha = $fecha;
     $this->page_module = 'Auditorías del sistema ' . $fecha;
     $this->page_format = $formato;
 }
開發者ID:slrondon,項目名稱:MikrotikCenter,代碼行數:18,代碼來源:auditoria_controller.php

示例10: add

 public function add()
 {
     if (IS_POST) {
         // p($_POST);exit;
         if ($this->db->store()) {
             View::success('發表成功', 'index');
         } else {
             View::error($this->db->getError());
         }
     } else {
         $cat = $this->category->getAll();
         View::with('cat', $cat)->make();
     }
 }
開發者ID:arnold1119,項目名稱:cms,代碼行數:14,代碼來源:ArticleController.php

示例11: isValidKey

 /**
  * Método para verificar si la llave es válida
  * 
  * @param string $id
  * @param string $action
  * @param string $filter Filtro a aplicar al id devuelto
  * @return boolean
  */
 public static function isValidKey($valueKey, $action = '', $filter = '', $popup = FALSE)
 {
     $key = explode('.', $valueKey);
     $id = $key[0];
     $validKey = self::getKey($id, $action);
     $valid = $validKey === $valueKey ? TRUE : FALSE;
     if (!$valid) {
         DwMessage::error('Acceso denegado. La llave de seguridad es incorrecta.');
         if ($popup) {
             View::error();
         }
         return FALSE;
     }
     return $filter ? Filter::get($id, $filter) : $id;
 }
開發者ID:slrondon,項目名稱:MikrotikCenter,代碼行數:23,代碼來源:dw_security.php

示例12: edit

 public function edit()
 {
     if (IS_POST) {
         if ($this->db->edit()) {
             View::success('操作成功', 'index');
         } else {
             View::error($this->db->getError());
         }
     } else {
         //分配品牌分類
         $cate = new \Admin\Model\ShopCate();
         $cateData = $cate->getAll();
         $field = $this->db->getOne();
         View::with('field', $field)->with('cateData', $cateData)->make();
     }
 }
開發者ID:ChenHuaPHP,項目名稱:ZOLshop,代碼行數:16,代碼來源:ShopBrandController.php

示例13: edit

 public function edit()
 {
     if (IS_POST) {
         p($_POST['thumb']);
         if ($this->db->update()) {
             View::success('修改成功', 'index');
         } else {
             View::error($this->db->getError());
         }
     }
     $id = Q('id', 0, 'intval');
     $data = $this->db->where('id', $id)->first();
     p($data);
     $data2 = new \Sadmin2\Model\Category();
     $data2 = $data2->getAll();
     View::with('data', $data)->with('data2', $data2)->make();
 }
開發者ID:arnold1119,項目名稱:cms,代碼行數:17,代碼來源:ArticleController.php

示例14: edit

 public function edit()
 {
     if (IS_POST) {
         if ($this->db->edit()) {
             View::success('操作成功', 'index');
         } else {
             View::error($this->db->getError());
         }
     } else {
         //搜索頁規格分類
         $type = new \Admin\Model\ShopType();
         $typeData = $type->getAll();
         View::with('typeData', $typeData);
         $data = $this->db->getAll();
         $field = $this->db->getOne();
         View::with('data', $data)->with('field', $field)->make();
     }
 }
開發者ID:ChenHuaPHP,項目名稱:ZOLshop,代碼行數:18,代碼來源:ShopCateController.php

示例15: edit

 public function edit()
 {
     if (IS_POST) {
         if ($this->db->update()) {
             View::success('修改成功', 'index');
         } else {
             View::error($this->db->getError());
         }
     } else {
         //讀取欄目數據
         $category = new \Admin\Model\Category();
         $cat = $category->getAll();
         //原文章的數據
         $field = Db::table('article')->where('id', $_GET['id'])->first();
         View::with('cat', $cat)->with('field', $field);
         View::make();
     }
 }
開發者ID:arnold1119,項目名稱:cms,代碼行數:18,代碼來源:ArticleController.php


注:本文中的View::error方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。