php 类定义和类使用实例

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

<?php
class emp
{
   var $name;
   var $address;
   var $dept;
   function assign_info($n,$a,$d)
   {
      $this->name=$n;
      $this->state=$a;
      $this->dept=$d;
   }
   function display_info()
   {
      echo("<p>Employee Name : $this->name");
      echo("<p>State : $this->state");
      echo("<p>Department : $this->dept");
   }
}
$empobj = new emp;
$empobj->assign_info("kaka lname","California","Accounts");
echo("<center><h2>Displaying Employee Information</h2></center>");
echo("<font size=4>");
$empobj->display_info();
echo("</font>");
?>