Home > Backend Development > PHP Tutorial > Implementation method of php single interface, php implementation_PHP tutorial

Implementation method of php single interface, php implementation_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 09:49:35
Original
960 people have browsed it

The implementation method of php single interface, php implementation

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:

<&#63;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"; 
   } 
  } 
&#63;>

Copy after login

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1019437.htmlTechArticleThe implementation method of php single interface, php implementation 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...
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template