ainila 发表于 2017-3-25 08:56:13

php重定向函数--集合

  1。当然是
  header("Location:http://blog.91.cn/bbsnewthreadtoblog.asp?tid=".$tid);}
  但是这个很多时候容易出问题,具体原因我还不是很清楚
  有一条,当前面输出了东西,是会出问题的,必须要在输出东西前调转,
  <?php
//echo "aaaa";
print("bbb");
//这里只要前面输入了内容,就不能用header函数实现跳转了
header("Location:http://www.qq.com");
?>
  注意header前不能有任何html语言之类的输出
location:后不能有空格

  2.die("<script>window.location.replace('http://blog.91.cn/bbsnewthreadtoblog.asp?tid=".$tid."');</script>");
  3。应该算是万能方法,js实现,肯定是不会有问题的,呵呵
  echo("<script>window.location=http://blog.91.cn/bbsnewthreadtoblog.asp?tid=".$tid.";
  当然了,还有一些是js变通的方法,比如
  echo "<script language='javascript'>";
echo "self.location="."'"."要转的页面名称";
echo "</script>";
  window.open("")
  等等,就不多说了,
  4.<?php
ob_start();
?>
html代码
<?
ob_clean();
include("next.php");
ob_end_flush();
?>
页: [1]
查看完整版本: php重定向函数--集合