redirect()
作用:设置网页重定向。
语法: null redirect(string $url[, int $code][, int $wait][, string $msg])
参数:
$url跳转的URL。$codeHTTP状态码,可选301(永久) 或302(暂时,默认)。$wait等待时间,单位 秒,默认值0。$msg跳转提示信息。
说明: 该函数提供三种方式用来跳转链接,即使在已经发送头部信息之后依旧能进行重定向网页。
示例:
<?php
redirect('test.php'); //跳转到当前目录下的 test.php 文件
redirect(site_url('test.php'), 301, 3, '该页面已永久重定向至 '.site_url('test.php')); //定时3秒,跳转到网站根目录下的 test.php 并输出提示信息