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


PHP BaseController::redirect方法代碼示例

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


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

示例1: loginAction

 /**
  * user login
  */
 public function loginAction()
 {
     parent::render('signin');
     if (isset($_POST['login'])) {
         $_SESSION['user'] = $_POST['user_id'];
         $user = new UserModel();
         if ($user->checkUser() === true) {
             parent::redirect("user", "userPage");
         } else {
             return $user->afterUnsuccessfulLogin();
         }
     }
 }
開發者ID:kapsi44,項目名稱:Gangouts,代碼行數:16,代碼來源:UserController.php

示例2: control_alterar_senha

 public function control_alterar_senha()
 {
     $user = $this->getUsuario();
     if ($this->app->isPostRequest) {
         try {
             if (false == UserHelper::password_verify($_POST['senha'], $user->getSenha())) {
                 $this->app->adicionarMensagemErro('A senha informada é inválida');
                 return $this->app->redirect('projetos/alterar-senha');
             }
             if ($_POST['senha_nova'] != $_POST['senha_confirmacao']) {
                 $this->app->adicionarMensagemErro('A senha e a confirmação da senha são diferentes');
                 return $this->app->redirect('projetos/alterar-senha');
             }
             $user->setSenha($_POST['senha_nova']);
             $this->app->em->persist($user);
             $this->app->em->flush();
             $this->app->adicionarMensagemSucesso('Sua senha foi atualizada com sucesso');
         } catch (Exception $e) {
             $this->app->adicionarMensagemErro('Ocorreu um erro e sua senha não foi alterada');
         }
     }
     return $this->app->renderizar('projetos/alterar-senha');
 }
開發者ID:umbernardo,項目名稱:banco_projetos,代碼行數:23,代碼來源:ProjetosController.php

示例3: loginAction

 /**
  *@return void 
  *Admin Login 
  */
 public function loginAction()
 {
     parent::render('admin');
     if (isset($_POST['submit'])) {
         session_start();
         $_SESSION['admin'] = $_POST['adminId'];
         echo $_SESSION['admin'];
         $adm = new AdminModel();
         if ($adm->checkAdmin() === true) {
             parent::redirect("Admin", "access");
         } else {
             echo "<h2 style='color:red'>Wrong Credentials</h2>";
         }
     }
 }
開發者ID:kapsi44,項目名稱:Gangouts,代碼行數:19,代碼來源:AdminController.php

示例4: searchAction

 /**
  * Execute the "search" based on the criteria sent from the "index"
  * Returning a paginator for the results
  */
 public function searchAction($id)
 {
     if (!parent::isValidId($id)) {
         parent::redirect('ping');
     }
     $builder = $this->createSearchBuilder();
     $builder->where('ping.id = ' . $id);
     $ping = $builder->getQuery()->getSingleResult();
     if ($ping) {
         $this->view->ping = $ping;
     } else {
         $this->flash->error('Identifier not found.');
         return parent::redirect('ping');
     }
     #$this->view->disable();
 }
開發者ID:sweetdevel,項目名稱:pingaroo,代碼行數:20,代碼來源:PingController.php

示例5: deleteAction

 /**
  * Deletes an existing product
  */
 public function deleteAction($id)
 {
     if (!parent::isValidId($id)) {
         return parent::redirect('country');
     }
     $manager = new TransactionManager();
     $transaction = $manager->get();
     try {
         $proxy = Proxy::findFirst($id);
         if ($proxy) {
             $proxy->setTransaction($transaction);
             $pings = $proxy->getPing();
             foreach ($pings as $ping) {
                 $ping->setTransaction($transaction);
                 $ping->delete();
             }
             $proxy->delete();
             $this->flash->success('Proxy deleted succesfully.');
             $transaction->commit();
         } else {
             $this->flash->notice('Proxy not found, operation aborted.');
         }
     } catch (\Exception $ex) {
         $this->flash->error('Error deleting proxy.');
         $transaction->rollback();
     }
     return $this->redirect('proxy');
 }
開發者ID:sweetdevel,項目名稱:pingaroo,代碼行數:31,代碼來源:ProxyController.php

示例6: deleteAction

 /**
  * Deletes an existing product
  */
 public function deleteAction($id)
 {
     if (!parent::isValidId($id)) {
         return parent::redirect('url');
     }
     $manager = new TransactionManager();
     $transaction = $manager->get();
     try {
         $url = Url::findFirst($id);
         if ($url) {
             $url->setTransaction($transaction);
             $batches = $url->getBatch();
             foreach ($batches as $batch) {
                 $batch->setTransaction($transaction);
                 $pings = $batch->getPing();
                 foreach ($pings as $ping) {
                     $ping->setTransaction($transaction);
                     $ping->delete();
                 }
                 $batch->delete();
             }
             $url->delete();
             $this->flash->success('Url deleted succesfully.');
             $transaction->commit();
         } else {
             $this->flash->notice('Url not found, operation aborted.');
         }
     } catch (\Exception $ex) {
         $this->flash->error('Error deleting url.');
         $transaction->rollback($ex->getMessage());
     }
     return $this->redirect('url');
 }
開發者ID:sweetdevel,項目名稱:pingaroo,代碼行數:36,代碼來源:UrlController.php

示例7: reloadAction

 public function reloadAction($id)
 {
     if (!parent::isValidId($id)) {
         $returnArg = '';
     } else {
         $batch = Batch::findFirst($id);
         if (!$batch) {
             $this->flash->error('Batch not found');
             $returnArg = '';
         } else {
             BatchHelper::reload($this->config, $batch);
             $returnArg = '?batchId=' . $id;
             $this->flash->success('Reloading pings...');
         }
     }
     return parent::redirect('batch' . $returnArg);
 }
開發者ID:sweetdevel,項目名稱:pingaroo,代碼行數:17,代碼來源:BatchController.php


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