Usage of php class Today we will talk about the basic usage of php class. First, you need to understand what a class is: The definition of a class is as follows:
Unique, flexible, versatile, important, these are the definitions of the same. For more detailed content, just go to www.111cn.cn to view it. Well, in order to give everyone a clearer understanding. Let’s take an example of what OOP is.
Class user{
var $u_uid; //username id english
var $u_mbname; // use template
var $u_css; //document stylewww.111cn.cn
var $u_documentbg; // full document background
var $u_csstop; // document top background
var $u_cssbottom; // bottom background
var $u_realname; // username realname Chinese
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>location='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: This site is original www.111cn.cn