The example in this article describes the implementation method of php single interface. Share it with everyone for your reference. The specific implementation method is as follows:
<?php interface staff_i { function setID($id); function getID(); function setName($name); function getName(); } class staff implements staff_i //该类用于实现staff_i接口 { private $id; private $name; function setID($id) { $this->id = $id; } function getID() { return $this->id; } function setName($name) { $this->name = $name; } function getName() { return $this->name; } function otherFunc() //这是一个接口中不存在的方法 { echo "Test"; } } ?>
I hope this article will be helpful to everyone’s PHP programming design.