Home  >  Article  >  Backend Development  >  PHP封装的一个支持HTML、JS、PHP重定向的多功能跳转函数_PHP

PHP封装的一个支持HTML、JS、PHP重定向的多功能跳转函数_PHP

WBOY
WBOYOriginal
2016-06-01 11:50:461166browse

PHP 跳转,即重定向浏览器到指定的 URL,是一个很常见的功能。这种功能也有一些细节性的要求,比如等待多少秒以后跳转,用不用JavaScript实现跳转,等等。下面的跳转方法考虑到很多,并参数化,可以用到具体的项目当中。

<?php   
/**   
 * 重定向浏览器到指定的 URL   
 *   
 * @param string $url 要重定向的 url   
 * @param int $delay 等待多少秒以后跳转   
 * @param bool $js 指示是否返回用于跳转的 JavaScript 代码   
 * @param bool $jsWrapped 指示返回 JavaScript 代码时是否使用 ';     
  }     
    
  if ($return) {     
    return $out;     
  }     
    
  echo $out;     
  exit;     
}    
?>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn