Home  >  Article  >  Backend Development  >  How to build a php interface

How to build a php interface

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-09-30 09:40:502987browse

How to build a php interface

Create interface

Create a file with the suffix php and name interface and add the php tag to the file.

How to build a php interface

Create two interface classes Jk1 and Jk2 in the page.

How to build a php interface

Related recommendations: "php Getting Started Tutorial"

Add methods jiekou1 and jiekou2 to each of the two interface classes. parameter.

How to build a php interface

Interface instantiation

Declare a class Slh and use implements to implement the two interfaces Jk1 and Jk2.

How to build a php interface

In class Slh, the methods jiekou1 and jiekou2 in the interface are indispensable, and the passed parameters are output.

How to build a php interface

Create an object and call the methods jiekou1 and jiekou2 in class Slh, and the passed parameters will be output respectively.

How to build a php interface

How to build a php interface

The above is the detailed content of How to build a php interface. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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