SHARE
TWEET

bugfix for showing flash message after redirect PHALCONPHP

a guest Aug 14th, 2014 238 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top