Exemple #1
0
 /**
  * redirect
  *
  * @method redirect
  * @param {string} $url
  * @param {int} $response_code
  * @param {boolean} $is_exit	exit()を実行するか
  */
 public static function redirect($url, $response_code = 302, $is_exit = true)
 {
     if (preg_match('#^https?://#iu', $url) <= 0) {
         $url = Atto::baseUrl() . $url;
     }
     $url = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%!]|iu', '', $url);
     $url = str_replace(array('%0d', '%0a'), '', $url);
     if (AttoServerSoftware::isIIS()) {
         Atto::setHeader('Refresh', '0;url=' . $url);
     } else {
         if (php_sapi_name() != 'cgi-fcgi') {
             self::setResponseCode($response_code);
         }
         self::setHeader('Location', $url);
     }
     if ($is_exit) {
         exit;
     }
 }