This article provides a detailed analysis of the meaning of interfaces in php interfaces. For more information, see
This article provides a detailed analysis of the meaning of interfaces in php interfaces. For more information, see
Everyone may understand this. I guess the meaning of this interface, which is used to call the interface content in the implementation class in the method called later, let's take a look at it later.
Pay. php
The Code is as follows:
Interface Ipay
{
Function withmoney ();
// Function withinternet ();
}
Class Dmeng implements Ipay
{
Function withmoney ()
{
Echo "shopping in RMB ";
}
Function withinternet ()
{
Return "pay with online banking ";
}
}
Usei. php
The Code is as follows:
Include_once 'pay. php ';
Class main
{
Function run ($ vc)
{
$ This-> vc = $ vc;
$ This-> vc-> withinternet ();
Echo "yunxing ";
}
}
$ Com = new main ();
$ Com-> run (new Dmeng );
As shown above, we comment out a method in the interface for the VM, Hong Kong server, and server space, and find that it is useless when it is called again.