本文整理汇总了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();
}
}
}
示例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');
}
示例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>";
}
}
}
示例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();
}
示例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');
}
示例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');
}
示例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);
}