PHP jump function and a generic action hint class to write _php tutorial

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.

 
 ';             } if ($return) {return $out;             } Echo $out;         Exit }?>


The writing of a generic operation hint class

In the design of some systems, often need to give users to operate the prompt. This hint is important, and friendly hints can improve the user's goodwill towards the system. Operation Tips There are a lot of designs, here is a humble plan for me, just a tip.

 
  Tips = "
 
   $string return (auto return after 4 seconds)", return $this->tips; Public Function __tostring () {        return $this->tips;    } Private Function __clone () {}public static function get_tips ($string, $url) {if (FALSE = = (Self::$_instance instanceof Self ) {self::$_instance = new self ($string, $url);} return self::$_instance;}    ? >

This class is simple enough to jump to a link after 4 seconds, or click to jump to that link.

__tostring () This function is very important, it can implement the string output of the class object.

How do you use this class?

Include_once ("./tips_class.php"); $hit = "Error: Two passwords entered are inconsistent"; $jump = ". /login.php "; Echo $tips = Tips::get_tips ($hit, $jump);



http://www.bkjia.com/PHPjc/755772.html www.bkjia.com true http://www.bkjia.com/PHPjc/755772.html techarticle The PHP jump, which redirects the browser to the specified URL, is a very common feature. This feature also has some details of the requirements, such as the number of seconds to wait after the jump, with no javascr ...

  • 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.