本文实例讲述了php类的定义与继承用法。分享给大家供大家参考。具体如下: <?php /* * class */ class people { public $name; public $age; function __construct($namec,$agec) { $this->name = $namec; $this->age = $agec; } protected function getmessage() { return "姓名:".$this->name.""."年龄:".$this->age; } f