PHP Package A multi-function jump function _php instance that supports HTML, JS, PHP redirection

Source: Internet
Author: User
The PHP jump, which redirects the browser to the specified URL, is a very common feature. This feature also has some detail requirements, such as how many seconds to wait after the jump, with no JavaScript to achieve jump, and so on. The following jump method takes into account a lot, and parameterization, can be used in specific projects.

<?php/** * Redirect browser to the specified URL * * @param string $url the URL to redirect * @param int $delay Wait how many seconds to jump * @param Boo L $JS Indicates whether to return JavaScript code for jumps * @param bool $jsWrapped Indicates whether to use when returning JavaScript code
 
  
   !--label * @param bool $return Indicates whether the generated JavaScript code is returned */function redir       ECT ($url, $delay = 0, $js = False, $jsWrapped = True, $return = False) {$delay = (int) $delay; if (! $js) {if (headers_sent () | | | $delay > 0) {echo <<
     
       EOT;         Exit           } else {Header ("Location: {$url}");         Exit       }} $out = ';       if ($jsWrapped) {$out. = ' 
    
   
  
 ';       } if ($return) {return $out;       } Echo $out;     Exit }?>
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.