dqjl0906 2014-11-05 01:37
浏览 33
已采纳

网页重定向无法正常工作

I'm making the index.php page for my website and I've come across multiple errors on line 13 of the code below, but I have fixed the majority of them. I've tried adding

</meta>

and even the ; , after http-equiv="refresh"

Here's my code:

<?php


session_start();


$username = $_SESSION['username'];

$password = $_SESSION['password'];

if(!$username && !$password){

echo "You will be redirected to login in 5 seconds! (<meta http-equiv="refresh"; content="5; URL=login.php"></meta>)";

}else{

echo "Welcome , ".$username."! (<a href=logout.php>Logout</a>)";

}



?>
  • 写回答

1条回答 默认 最新

  • duanji1482 2014-11-05 01:42
    关注

    the problem is the double quote inside your double quote.. escape them using \ or use single quote instead.

    echo "You will be redirected to login in 5 seconds! (<meta http-equiv=\"refresh\"; content=\"5; URL=login.php\">)";
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 宇视监控服务器无法登录
  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥15 DruidDataSource一直closing
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据