當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。