<?php $this->flash->error("this is error"); $this->dispatcher->forward(array( 'controller' => 'index', 'action' => 'index' )); ?> But no error information output is directed to ask me how to do?
|
Jan '15 |
4 |
1010 |
0 |
On the view $this->flash->output();
If that still doesn't work, use flashSession
instead. I think flash
works just on the same page without redirect, not sure about forwarding. View its $this->flashSession->output();
, flashSession is already set if you're using the \Phalcon\DI\FactoryDefault(). Otherwise:
$di->set('flashSession', function() {
return new \Phalcon\Flash\Session();
});
On the view
$this->flash->output();
If that still doesn't work, use
flashSession
instead. I thinkflash
works just on the same page without redirect, not sure about forwarding. View its$this->flashSession->output();
, flashSession is already set if you're using the \Phalcon\DI\FactoryDefault(). Otherwise:$di->set('flashSession', function() { return new \Phalcon\Flash\Session(); });
Fatal error: Call to undefined method Phalcon\Flash\Direct::output() in
I don't know what causes it, please help and have a look, thank you
for index.php
$di->set('flash', function() {
return new Phalcon\Flash\Direct(array(
'output'
'error' => 'alert alert-error',
'success' => 'alert alert-success',
'notice' => 'alert alert-info',
));
});
$di->set('flashSession',function() {
return new \Phalcon\Flash\Session();
});
for controller
public function indexAction() { $this->flash->output("aaaa"); return $this->dispatcher->forward(array( 'controller' => 'family', 'action' => 'index'; )); }
On the view
$this->flash->output();
If that still doesn't work, use
flashSession
instead. I thinkflash
works just on the same page without redirect, not sure about forwarding. View its$this->flashSession->output();
, flashSession is already set if you're using the \Phalcon\DI\FactoryDefault(). Otherwise:$di->set('flashSession', function() { return new \Phalcon\Flash\Session(); });
I think I a mistake I want to achieve such an effect:
echo "<script>alert('111111')</script>"; return $this->dispatcher->forward(array( 'controller' => 'family', 'action' => 'index' ));
The first pop-up to the error message to the user, and then jump
for controller
public function indexAction() {
$this->flashSessiont("aaaa"); <-- use flashSession
return $this->dispatcher->forward(array(
'controller' => 'family',
'action' => 'index';
));
}
for controller
public function indexAction() {
$this->flashSessiont("aaaa"); <-- use flashSession
return $this->dispatcher->forward(array(
'controller' => 'family',
'action' => 'index';
));
}
Tip can't find flashSession method I need inside the controller is you use?
Oh, my mistake sorry, that is code error,
\Phalcon\Flash\Session
is the object, missing the method call there, this is the right one:$this->flashSession->success("aaaa"); // or ->warning(), ->notice(), ->error()
Program has an error, but still no output information jump go, I want to achieve before you jump to the user show error message