如何使用php实现重定向

如何使用php实现重定向

本篇文章为大家展示了如何使用php实现重定向,代码简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。

php实现重定向的方法:1、【header()】函数,代码为【header('location:http://www.baidu.com')】;2、meta标签,代码为【echo '<meta http-equiv="refresh" 】。

php实现重定向的方法:

1、header()函数;

header('location:http://www.baidu.com');

2、meta标签;

echo '<meta http-equiv="refresh" content="1;url=http://www.baidu.com">';

3、script标签;

echo '<script>window.location.href="http://www.baidu.com"</script>';


上述内容就是如何使用php实现重定向,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注行业资讯频道。