代码示例:
$car = new car(); $car->startLog(); trait trait_class { public function startLog(){ echo "start log"; } public function endLog(){ echo "end log"; } } class car { use trait_class; }
输出结果:start log
时间: 2024-10-23 12:49:46
代码示例:
$car = new car(); $car->startLog(); trait trait_class { public function startLog(){ echo "start log"; } public function endLog(){ echo "end log"; } } class car { use trait_class; }
输出结果:start log