We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Routes redirect

Hi, I have this route redirect and it works, but after->send() , I didn't get the flashMessages. I should use exit; after ->send() and everything works correctly.

No flashMsg:

$this->response->redirect(array("for" => "admin-company-acc-companies-add"));
$this->response->send();

Example (i get them):

$this->response->redirect(array("for" => "admin-company-acc-companies-add"));
$this->response->send();
exit;

Is it a bug or ?



98.9k
Accepted
answer

You have to return the response:

return $this->response->redirect(array("for" => "admin-company-acc-companies-add"));