Advertisement
Guest User

bugfix for showing flash message after redirect PHALCONPHP

a guest
Aug 14th, 2014
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.66 KB | None | 0 0
  1. <?php
  2. namespace Core\Http;
  3.  
  4. /**
  5.  * Description of Response
  6.  *
  7.  * @author softdream
  8.  */
  9. class Response extends \Phalcon\Http\Response {
  10.     //put your code here
  11.    
  12.     public function redirect($locationPath = null, $baseUrl = null, $statusCode = null) {
  13.         if($statusCode){
  14.             $this->setStatusHeader($code);
  15.         }
  16.        
  17.         if(substr($locationPath, 0,1) === '/'){
  18.             $locationPath = substr($locationPath, 1);
  19.         }
  20.        
  21.         header("Location: ".$baseUrl.'/'.$locationPath);
  22.         exit;
  23.     }
  24.    
  25.     protected function setStatusHeader($code){
  26.         header("HTTP/1.0 ".$code);
  27.     }
  28.    
  29.    
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement