Php OOP class usage

Source: Internet
Author: User

Php class usageToday, let's talk about php class in basic usage. First, you need to understand what a class is: the definition of a class is as follows:

It is unique, flexible, universal, and important. This is a definition of the like. For more details, visit www.111cn.cn, well, we will give an example to help you better understand what OOP is.

Class user {
Var $ u_uid; // username id english
Var $ u_mbname; // use temptlete
Var $ u_css; // document stylewww.111cn.cn
Var $ u_documentbg; // full document background
Var $ u_csstop; // doucument top background
Var $ u_cssbottom; // bottom background
Var $ u_realname; // username realname Chinse
Var $ u_id; // tablename id replace tag;
Var $ u_edu;
Var $ u_work;
Var $ u_head; www.111cn.cn
Var $ u_sitename;
Var $ u_visited;
Var $ u_blog;
Var $ host;

Function userinfo ($ id ){
$ Id = $ this-> safe_function ($ id );
If (empty ($ id) |! Is_numeric ($ id) {exit ("<script> location1_'error.html '; </script> ");}
$ SQL = "select * from uidname where u_id = '$ id '";
$ Result = mysql_query ($ SQL) or die ("Error system busy... plase wait! ");
If (mysql_num_rows ($ result )){
$ Rs = mysql_fetch_object ($ result );
$ This-> u_id = $ rs-> id; www.111cn.cn
$ This-> u_uid = $ rs-> username;
$ This-> u_realname = $ rs-> realname;
$ This-> u_documentbg = $ rs-> documentbg;
$ This-> u_csstop = $ rs-> csstop;
$ This-> u_cssbottom = $ rs-> cssbottom;
$ This-> u_mbname = $ rs-> mbname;
$ This-> u_edu = $ rs-> edu;
$ This-> u_work = $ rs-> works;
$ This-> u_sitename = $ rs-> sitename;
$ This-> u_visited = $ rs-> visited;
$ This-> u_blog = $ rs-> u_id;
} Else {
Header ("location: blog/error. php"); exit;
}
}

}

Note: original site www.111cn.cn

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.