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


PHP Session::setFlash方法代码示例

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


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

示例1: index

 public function index()
 {
     $action = isset($_GET['action']) ? $_GET['action'] : 'list';
     $lang = isset($_GET['language']) ? $_GET['language'] : 'list';
     if ($action == 'add') {
         $id = $_GET['id'];
         $this->model->addProduct($id);
         header('Location: /' . $lang . '/carts/index');
     } elseif ($action == 'delete') {
         $id = $_GET['id'];
         $this->model->deleteProduct($id);
         header('Location: /' . $lang . '/carts/index');
     } elseif ($action == 'clear') {
         $this->model->clear();
         header('Location: /' . $lang . '/carts/index');
     } else {
         if ($this->model->isEmpty()) {
             Session::setFlash(__('empty_cart'));
         } else {
             $id_sql = $this->model->getProducts(true);
             if ($id_sql) {
                 $this->data['cart'] = $this->model->getCart($id_sql);
                 $this->data['sum'] = $this->model->getSum($id_sql);
             }
         }
     }
 }
开发者ID:maksym-kasianov-nikohdiuk,项目名称:MVC,代码行数:27,代码来源:carts.controller.php

示例2: logoutAction

 public function logoutAction($key = 'user')
 {
     Session::remove($key);
     Session::destroy();
     Session::setFlash(__t('you_logout'));
     $this->redirect("/");
 }
开发者ID:artemkuchma,项目名称:php_academy_site2,代码行数:7,代码来源:SecurityController.php

示例3: login_process

 function login_process()
 {
     $form = $this->load->form('login', $_POST);
     if (!$form->validate()) {
         Session::setFlash('next', $form->next->getValue());
         $this->helper->redirect->flash(UrlHelper::referer(), $form->getId(), $form->getFlashParams());
     }
     $values = $form->getValue();
     if ($form->next->getValue()) {
         #Parameters 'auth' => 'login' are passed as a flash to the next page
         $this->view->setRedirect($form->next->getValue(), 'auth', 'login');
     } else {
         $this->view->setRedirect('/');
     }
     $user_id = $this->db->Auth->getUserId($values['username'], $values['password']);
     if (!$user_id && $this->config['old_password']) {
         $user_id = $this->db->Auth->getUserIdFromOldPassword($values['username'], $form->password->getRawValue());
     }
     if (!$user_id) {
         $form->username->setErrorCode('invalid');
         $this->helper->redirect->flash(UrlHelper::referer(), $form->getId(), $form->getFlashParams());
     }
     if (!$this->db->Auth->isEnabled($user_id)) {
         $this->helper->redirect->flash(UrlHelper::referer(), $form->getId(), $form->getFlashParams());
     }
     if (!$this->db->Auth->isActivated($user_id)) {
         $this->helper->redirect->to('/auth/unconfirmed');
     }
     $this->plugin->Auth->login($user_id, $form->remember->isChecked(), $values['module']);
 }
开发者ID:RNKushwaha022,项目名称:orange-php,代码行数:30,代码来源:auth.controller.php

示例4: run

 public static function run($uri)
 {
     self::$router = new Router($uri);
     self::$db = new DB(Config::get('db.host'), Config::get('db.user'), Config::get('db.password'), Config::get('db.db_name'));
     Lang::load(self::$router->getLanguage());
     $controller_class = ucfirst(self::$router->getController()) . 'Controller';
     $controller_method = strtolower(self::$router->getMethodPrefix() . self::$router->getAction());
     $layout = self::$router->getRoute();
     if (Session::get('role') == 'user') {
         Session::setFlash('Welcome!');
     } elseif ($layout == 'admin' && Session::get('role') != 'admin') {
         if ($controller_method != 'admin_login') {
             Router::redirect('/users/admin_login');
         }
     }
     $controller_object = new $controller_class();
     if (method_exists($controller_object, $controller_method)) {
         // Controller`s action may return a view path
         $view_path = $controller_object->{$controller_method}();
         $view_object = new View($controller_object->getData(), $view_path);
         $content = $view_object->render();
     } else {
         throw new Exception('Method' . $controller_method . ' of class ' . $controller_class . ' does not exist.');
     }
     $layout = self::$router->getRoute();
     $layout_path = VIEWS_PATH . DS . $layout . '.html';
     $layout_view_object = new View(compact('content'), $layout_path);
     echo $layout_view_object->render();
 }
开发者ID:maksym-kasianov-nikohdiuk,项目名称:MVC,代码行数:29,代码来源:app.class.php

示例5: admin_index

 public function admin_index()
 {
     if ($_POST) {
         if (isset($_POST['delete'])) {
             $id = isset($_POST['id']) ? $_POST['id'] : 0;
             $id = (int) $id;
             $this->model->deleteNewsById($id);
         } elseif (isset($_POST['change'])) {
             $id = isset($_POST['id']) ? $_POST['id'] : 0;
             $id = (int) $id;
             $title = isset($_POST['title']) ? $_POST['title'] : 0;
             $description = isset($_POST['description']) ? $_POST['description'] : 0;
             $body = isset($_POST['body']) ? $_POST['body'] : 0;
             $is_top = 0;
             if (isset($_POST['is_top'])) {
                 $is_top = 1;
             }
             $this->model->changeNews($id, $title, $description, $body, $is_top);
             Session::setFlash("Новина змінена!");
         } elseif (isset($_POST['add'])) {
             $title = isset($_POST['title']) ? $_POST['title'] : 0;
             $description = isset($_POST['description']) ? $_POST['description'] : 0;
             $body = isset($_POST['body']) ? $_POST['body'] : 0;
             $on_date = isset($_POST['on_date']) ? $_POST['on_date'] : date("Y-m-d");
             $is_top = 0;
             if (isset($_POST['is_top'])) {
                 $is_top = 1;
             }
             $this->model->addNews($title, $description, $body, $is_top, $on_date);
             Session::setFlash("Новина додана!");
         }
     }
     $this->data['news'] = $this->model->getAllNews();
 }
开发者ID:qconer,项目名称:php_kamgaz,代码行数:34,代码来源:news.controller.php

示例6: index

 public function index()
 {
     if ($_POST) {
         if ($this->model->save($_POST)) {
             Session::setFlash('Thank You! Your message was sent successfull');
         }
     }
 }
开发者ID:vovella,项目名称:homeworks,代码行数:8,代码来源:contacts.controller.php

示例7: add

 public function add()
 {
     if ($_POST) {
         if ($this->model->newClient($_POST)) {
             Session::setFlash('You registered!');
         }
     }
 }
开发者ID:maksym-kasianov-nikohdiuk,项目名称:MVC,代码行数:8,代码来源:users.controller.php

示例8: index

 public function index()
 {
     if ($_POST['name'] && $_POST['email'] && $_POST['message']) {
         if ($this->model->save($_POST)) {
             Session::setFlash("Спасибо! Ваше сообщение было отправлено");
         }
     }
 }
开发者ID:NecroAgronom,项目名称:gasket-store,代码行数:8,代码来源:contacts.controller.php

示例9: user_user

 public function user_user()
 {
     if (isset($this->params[0])) {
         $this->data = $this->model->showUser($this->params[0]);
     } else {
         Session::setFlash('Error');
     }
 }
开发者ID:gudvon,项目名称:MySite,代码行数:8,代码来源:profiles.controller.php

示例10: show

 public function show()
 {
     /*$this->data = $this->model->getList();*/
     if (isset($this->params[0])) {
         $this->data['page'] = $this->model->getById($this->params[0]);
     } else {
         Session::setFlash('Wrong page id.');
         Router::redirect('/admin/pages/');
     }
 }
开发者ID:vovella,项目名称:homeworks,代码行数:10,代码来源:requests.controller.php

示例11: upload

 public function upload()
 {
     if (isset($_FILES['myFile'])) {
         if (!$_FILES['myFile']['error']) {
             move_uploaded_file($_FILES['myFile']['tmp_name'], self::UPL_DIR . $_FILES['myFile']['name']);
             Session::setFlash('Файл успешно загружен');
         } else {
             Session::setFlash('Ошибка. Файл не был отправлен');
         }
     }
 }
开发者ID:e-lev777,项目名称:weather,代码行数:11,代码来源:UploadedFile.php

示例12: index

 public function index()
 {
     if (!is_null($_POST['name']) && !is_null($_POST['email']) && !is_null($_POST['message']) && strlen($_POST['name']) > 0 && strlen($_POST['email']) > 0 && strlen($_POST['message']) > 0) {
         if ($this->model->save($_POST)) {
             Session::setFlash('OK. Message was sent');
         }
     }
     if ($_POST['back']) {
         Router::redirect('/');
     }
 }
开发者ID:tgamanov,项目名称:SkynetPR,代码行数:11,代码来源:contacts.controller.php

示例13: admin_delete

 public function admin_delete()
 {
     if (isset($this->params[0])) {
         $result = $this->model->delete($this->params[0]);
         if ($result) {
             Session::setFlash('good was deleted!');
         } else {
             Session::setFlash('Error');
         }
     }
     Router::redirect('/admin/goods/');
 }
开发者ID:maksym-kasianov-nikohdiuk,项目名称:MVC,代码行数:12,代码来源:goods.controller.php

示例14: member__login

 public function member__login()
 {
     $username = Request::post('username');
     $password = Request::post('password');
     $return = Request::post('return');
     if (Statamic_Auth::login($username, $password)) {
         Session::setFlash('success', 'Success');
     } else {
         Session::setFlash('error', 'Failure');
     }
     URL::redirect(URL::assemble(Config::getSiteRoot(), $return));
 }
开发者ID:nob,项目名称:joi,代码行数:12,代码来源:hooks.member.php

示例15: index

 public function index()
 {
     if ($_POST) {
         if ($this->model->save($_POST)) {
             Session::setFlash('Thank you! Your message was sent successfully!');
             echo "Спасибо, форма отправлена!";
         } else {
             echo "Ошибка!!!";
         }
         exit;
     }
 }
开发者ID:oleg-shumar,项目名称:php-academy.kiev.ua,代码行数:12,代码来源:contacts.controller.php


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