Kohana v3 - Passing variables through Request::instance()->redirect()
[Kohana v3] Is there any way to pass variables to the views through Request::instance()->redirect(). What would be a开发者_运维技巧 good alternative? Thanks!
Before you call the redirect do these in your controller:
$success = "Your Email has send successfully";
$session = Session::instance();
$session->set('success', $success);
$this->redirect('contact-us', 302);
then in your view page to get the value you do these
<?php
$session = Session::instance();
$success = $session->get_once('success');
if (!empty($success)) : ?>
<div class="alert alert-success fade in">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
<strong>Success! </strong><?=$success?>
</div>
<?php endif;?>
that's all.
Deceptively easy if this works for you:
Request::instance()->redirect('/dashboard?err=incomplete');
No reason you can't build the string using any number of $_GET parameters.
精彩评论