爱问知识人 爱问教育 医院库

php重定向后跳转不了

首页

php重定向后跳转不了


        

提交回答
好评回答
  • 2023-04-05 08:30:00

    PHP中重定向网页跳转页面的方法有三种,下面为大家详细介绍一下。

    第一种:利用header()函数进行重定向,这也是我用的较多的。(注意!location和“:”之间不能有空格,否则无作用!)

    <php header('content-type:text/html;charset=uft-8); //重定向页面 header('location:index.php'); ?>

    第二种:利用HTML 头部中的 meta标签,定义http-equiv=refresh 和content=”跳转花费的时间(秒为单位);url=跳转地址”

    <DOCTYPE html><html><head> <meta charset="UTF-8"> //跳转页面,跳转时间:3秒钟,目标地址:index.php <meta http-equiv="refresh" content="3;url=index.php"> <title>skip.</title></head>

    或者

    <phpheader('content-type:text/html;charset=utf-8');$url='index.php' ?> <DOCTYPE html><html><head> <meta charset="UTF-8"> //跳转页面,跳转时间:2秒钟,目标地址:index.php <meta http-equiv="refresh" content="2;url=<php echo $url; ?>"> <title>skip.</title></head>

    第三种:利用javascript进行跳转

    <phpheader('content-type:text/html;charset=utf-8');$url='index.php'//立即跳转至目标页面echo <script>window.location.href='$url'</script>>

    以上内容仅供参考!

    推荐视频教程:PHP视频教程

    本***

    2023-04-05 08:30:00

类似问题

换一换
  • 电脑/网络 相关知识

  • 电脑网络技术
  • 电脑网络

相关推荐

正在加载...
最新资料 推荐信息 热门专题 热点推荐
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200

热点检索

  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
返回
顶部
帮助 意见
反馈

确定举报此问题

举报原因(必选):