选择语言 :

 Core_HttpIO::redirect

页面跳转

void Core_HttpIO::redirect( string $url [, integer $code = integer 302 ] )
uses
Core_url::site
HttpIO::send_headers

参数列表

参数 类型 描述 默认值
$url string Redirect location
$code integer Status code: 301, 302, etc integer 302
返回值
  • void
File: ./core/classes/httpio.class.php
public static function redirect($url, $code = 302)
{
    if (strpos($url, '://') === true)
    {
        // Make the URI into a URL
        $url = Core::url($url);
    }

    // Set the response status
    HttpIO::$status = $code;

    // Set the location header
    HttpIO::$headers['Location'] = $url;

    // Send headers
    HttpIO::send_headers();

    // Stop execution
    exit();
}