Example #1
0
 /**
  * redirect to <pre>$location</pre> or any Error page
  * @param  string|Code $location url to move to 
  * @param  array $with params sent with the url
  * @param  int $after num of second to wait before redirecting
  * @return void
  */
 public static function redirectTo($location, $with = [], $after = 0)
 {
     if (!empty($with)) {
         foreach ($with as $k => $v) {
             Request::appendParam($k, $v);
         }
     }
     if (empty($location)) {
         $location = Url::app();
     } else {
         if (!empty($location) && $after > 0) {
             // Redriect with a after:
             header("Refresh: {$after}; url={$location}");
             return;
         }
     }
     header("Location: {$location}");
 }