santaclaus 发表于 2017-3-22 06:20:40

php实现页面转发

<?php
  #php实现页面转发的三种方法.
  /**
  * php 5.x
  * @author mak0000@msn.com
  */
class Response
{
  public static function forward($s)
  {
      echo "<script language='javascript'>";
     echo "window.location='$s'";
     echo "</script>";
   }
  public static function redirect($s)
  {
    echo "<META HTTP-EQUIV='Refresh' CONTENT='0;URL=$s'>";
   }
  public static function update($s)
   {
    ob_start();
     header("location:$s");
    ob_end_flush();
  }
}
?>


<?php   
  /**
  * php 4.x
  */
class Response   
{   
   function forward($s)   
  {   
      echo "<script language='javascript'>";   
     echo "window.location='$s'";   
     echo "</script>";   
   }   
  function redirect($s)   
  {   
    echo "<META HTTP-EQUIV='Refresh' CONTENT='0;URL=$s'>";   
   }   
  function update($s)   
   {   
    ob_start();   
     header("location:$s");   
    ob_end_flush();   
  }   
}   
?>

 
页: [1]
查看完整版本: php实现页面转发