Compile a simple PHP operation prompt class

Source: Internet
Author: User

When designing some systems, users are often prompted for the operation. This kind of prompt is very important, and friendly prompt can improve the user's sense of the system. There are a lot of design tips. Below is a simple solution for me.

Operation prompt class: tips_class.php

<? Phpclass Tips {private $ tips; static private $ _ instance; private function _ construct ($ string, $ url) {$ this-> tips = "<meta http-equiv = refresh content = 4; url = $ url> <div style = 'border: 1px solid # B4D8F4; width: 320px; height: 120px; margin: 0 auto; font-size: 12px; '> <div style = 'background-color: # CDE6F9; height: 20px; '> </div> <div align = 'center' style = 'font-size: 14px; font-weight: bold; margin: 20px 0 20px 0;'> $ stri Ng </div> <div align = 'center'> <a href = '$ url'> return </a> (automatically returned in 4 seconds) </div> "; 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 type of function is very simple, that is, jump to a link after 4 seconds, or click to jump to that link.

The _ toString () function is very important. It can implement the string output of class objects.

How to use this class?

Include_once (". /tips_class.php "); $ hit =" error: the two passwords are inconsistent "; $ jump = ".. /login. php "; echo $ tips = Tips: get_tips ($ hit, $ jump );

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.